Tiny memory leak in lib/version.c
authorCorinna Vinschen <corinna@vinschen.de>
Sat, 19 Jan 2008 14:14:45 +0000 (15:14 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 19 Jan 2008 18:30:16 +0000 (19:30 +0100)
commit373a23d48f2dd24e65dbf814ea58b4add2322128
tree7e714e44dd19fc1d9231206414ec6c96fe75f67f
parent64e54ea8f76fe57193955aabc1459fe635233aca
Tiny memory leak in lib/version.c

Hi,

while implementing the extra_info version stuff, it occured to me that
samba_version_string() potentially allocates memory which is unused but
never free'd.

If SAMBA_VERSION_VENDOR_PATCH is defined, a second call to asprintf
takes place.  The result is stored in tmp_version.  Afterwards,
samba_version is set to tmp_version without free'ing samba_version
first.  Looks like a simple free(samba_version) is missing.  Patch
against 3.2-test below.

Ok, this only happens once over the lifetime of the application, so it's
no big deal, but I though it doesn't hurt to mention it.

Corinna

* lib/version.c (samba_version_string): Free samba_version
before setting to tmp_version.
source/lib/version.c