bug-gnu-utils
[Top][All Lists]
Advanced

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

gdbm - memory leak in gdbm_reorganize


From: Doru Petrescu
Subject: gdbm - memory leak in gdbm_reorganize
Date: Wed, 25 Apr 2001 09:43:57 +0300 (EEST)

Hi,

I think that I found a small memory leak in gdbm_reorganize()
After the new DB is created and all keys are copyed, and all the usefull
information have been copyed from new_dbf to dbf, the new_dbf is
free()ed, but no one release the memory for new_dbf->name

so my patch is quite short: add a "free (new_dbf->name);" on line 205 of
file gdbmreorg.c, like this:

--- gdbmreorg.c Wed Apr 25 09:26:10 2001
+++ my_gdbmreorg.c      Wed Apr 25 09:26:07 2001
@@ -202,7 +202,9 @@
   dbf->directory_changed = new_dbf->directory_changed;
   dbf->bucket_changed    = new_dbf->bucket_changed;
   dbf->second_changed    = new_dbf->second_changed;
+
+  free (new_dbf->name);
+
   free (new_dbf);
   free (new_name);



BTW, I am using GDBM-1.8.0, gdbm-1.8.0.tar.gz is 134080 bytes long ...

Best regards,
Doru Petrescu







reply via email to

[Prev in Thread] Current Thread [Next in Thread]