The Samba-Bugzilla – Bug 6398
[PATCH] Memory leaks in source4/client/smbumount.c
Last modified: 2009-05-29 10:45:55 UTC
cppcheck found two possible memory leaks in canonicalize() function in file source4/client/smbumount.c See patch in attach.
Also I made another patch which reorder checks to avoid strlen(NULL) call.
Created attachment 4193 [details]
Reorder checks to avoid strlen(NULL) call
Created attachment 4194 [details]
Fix for 2 possible memory leaks in source4/client/smbumount.c
BTW, in some cases we may not check path to NULL and just call relapath() with second argument equals to NULL:
If resolved_path is specified as NULL, then realpath() uses malloc(3) to allocate a buffer of
up to PATH_MAX bytes to hold the resolved pathname, and returns a pointer to this buffer. The
caller should deallocate this buffer using free(3).
POSIX.1-2001 says that the behavior if resolved_path is NULL is implementation-defined.
POSIX.1-2008 specifies the behavior described in this page.
And this may be not portable :-(
This will not be fixed since we don't support smbmount/smbumount anymore. See http://gitweb.samba.org/samba.git/?p=samba.git;a=commitdiff;h=e8ea854f0262ea2a1449695a0c70bea40bfbb872