NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/46899: memory leak in libutil - getfsspecname()

>Number:         46899
>Category:       lib
>Synopsis:       memory leak in libutil - getfsspecname()
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 04 12:05:00 +0000 2012
>Originator:     Wolfgang Stukenbrock
>Release:        NetBSD-current
Dr. Nagler & Company GmbH
System: NetBSD test-s0 4.0 NetBSD 4.0 (NSW-WS) #0: Tue Aug 17 17:28:09 CEST 
2010 wgstuken@test-s0:/usr/src/sys/arch/amd64/compile/NSW-WS amd64
Architecture: x86_64
Machine: amd64
        There are missing free() calls for the variables drives and vname
        prior returning variable buf to caller to signal success.
        Found by a look into the sources.
        add missing free() calls - e.g. with a patch like this:

        char *p = strstr(buf, "/rdk");
-       if (p++ == NULL)
-               return buf;
-       strcpy(p, p + 1);
+       if (p++ != NULL)
+               strcpy(p, p + 1);
        return buf;


Home | Main Index | Thread Index | Old Index