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
>Organization:
Dr. Nagler & Company GmbH
>Environment:
        
        
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
>Description:
        There are missing free() calls for the variables drives and vname
        prior returning variable buf to caller to signal success.
>How-To-Repeat:
        Found by a look into the sources.
>Fix:
        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);
        free(drives);
        free(vname);
        return buf;

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index