From 392f10a02b1effd254f3a751e42daccf929c3efa Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sun, 29 Jul 2012 00:30:48 +0200 Subject: [PATCH] clean-temp: Fix memory leak. * lib/clean-temp.c (cleanup_temp_dir): Free also the 'subdirs' and 'files' members of tmpdir. --- ChangeLog | 6 ++++++ lib/clean-temp.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 378c40556..aa6941880 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-07-28 John Darrington + + 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 maint.mk: new rule: refresh-gnulib-patches diff --git a/lib/clean-temp.c b/lib/clean-temp.c index ef926e52d..55eeb0145 100644 --- a/lib/clean-temp.c +++ b/lib/clean-temp.c @@ -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; -- 2.11.0