diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-01-19 15:14:45 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-01-19 19:30:16 +0100 |
commit | a0bd9d97a3a701fdb1f9a48ce925f63b786a8070 (patch) | |
tree | b5261d848d460038d61bc0d410552906514bfcb9 | |
parent | 70f88005c77cee0848a495da139144206b53eb3f (diff) | |
download | samba-a0bd9d97a3a701fdb1f9a48ce925f63b786a8070.tar.gz samba-a0bd9d97a3a701fdb1f9a48ce925f63b786a8070.tar.bz2 samba-a0bd9d97a3a701fdb1f9a48ce925f63b786a8070.zip |
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.
(This used to be commit 373a23d48f2dd24e65dbf814ea58b4add2322128)
-rw-r--r-- | source3/lib/version.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/source3/lib/version.c b/source3/lib/version.c index 204c2044a8..cbb70ae8a6 100644 --- a/source3/lib/version.c +++ b/source3/lib/version.c @@ -51,6 +51,7 @@ const char *samba_version_string(void) */ assert(res != -1); + free(samba_version); samba_version = tmp_version; #endif |