clean-temp: Fix memory leak.
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 28 Jul 2012 22:30:48 +0000 (00:30 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 28 Jul 2012 22:30:48 +0000 (00:30 +0200)
* lib/clean-temp.c (cleanup_temp_dir): Free also the 'subdirs' and
'files' members of tmpdir.

ChangeLog
lib/clean-temp.c

index 378c405..aa69418 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-07-28  John Darrington  <john@darrington.wattle.id.au>
+
+       clean-temp: Fix memory leak.
+       * lib/clean-temp.c (cleanup_temp_dir): Free also the 'subdirs' and
+       'files' members of tmpdir.
+
 2012-07-27  Jim Meyering  <meyering@redhat.com>
 
        maint.mk: new rule: refresh-gnulib-patches
index ef926e5..55eeb01 100644 (file)
@@ -556,7 +556,10 @@ cleanup_temp_dir (struct temp_dir *dir)
           }
         else
           cleanup_list.tempdir_list[i] = NULL;
-        /* Now only we can free the tmpdir->dirname and tmpdir itself.  */
+        /* Now only we can free the tmpdir->dirname, tmpdir->subdirs,
+           tmpdir->files, and tmpdir itself.  */
+        gl_list_free (tmpdir->files);
+        gl_list_free (tmpdir->subdirs);
         free (tmpdir->dirname);
         free (tmpdir);
         return err;