summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoffredo Baroncelli <kreijack@inwind.it>2017-01-27 02:16:08 +0100
committerBernhard Voelker <mail@bernhard-voelker.de>2017-02-06 22:25:15 +0100
commitc1556892a639f609e6d63cd456c2062419e06459 (patch)
treeddb9cd0abfc7647bbd3d9a5c2bd9475540a241f6
parente4e142a8dcf2c7c1bb82a4a24d4178cac058d8f4 (diff)
downloadfindutils-c1556892a6.tar.gz
find: fix memory leak in mount list handling
The following gnulib commit added the structure member me_mntroot which our free_file_system_list function didn't consider, thus leading to a memory leak: http://git.sv.gnu.org/cgit/gnulib.git/commit/?id=c6148bca89e9 * find/fstype.c (free_file_system_list): Use gnulib's free_mount_entry function to free the mount list instead of free()ing all members here manually. * NEWS (Bug Fixes): Mention the fix. Reported in http://lists.gnu.org/archive/html/findutils-patches/2016-12/msg00000.html
-rw-r--r--NEWS3
-rw-r--r--find/fstype.c9
2 files changed, 4 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index 6b890c3..ba89f9d 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,9 @@ in the use of FTS.
** Bug Fixes
+find no longer leaks memory for a recently added member in gnulib's
+mount list structure.
+
#48180: find -noop (an internal option not intended to be exposed to the user)
no longer crashes. Bug introduced in FINDUTILS-4.3.1.
diff --git a/find/fstype.c b/find/fstype.c
index 535f920..a0ac8bc 100644
--- a/find/fstype.c
+++ b/find/fstype.c
@@ -75,14 +75,7 @@ free_file_system_list (struct mount_entry *p)
while (p)
{
struct mount_entry *pnext = p->me_next;
-
- free (p->me_devname);
- free (p->me_mountdir);
-
- if (p->me_type_malloced)
- free (p->me_type);
- p->me_next = NULL;
- free (p);
+ free_mount_entry (p);
p = pnext;
}
}