summaryrefslogtreecommitdiff
path: root/lib/mountlist.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-07-18 12:28:31 +0000
committerJim Meyering <jim@meyering.net>1998-07-18 12:28:31 +0000
commit1af4f2f11d0e760694366347757f08bafec39b4c (patch)
tree8155734a60642996d2075297277a6225728058e4 /lib/mountlist.c
parent1703d0d59c6a398572e2d2f0d1560369affc93db (diff)
downloadcoreutils-1af4f2f11d0e760694366347757f08bafec39b4c.tar.xz
(read_filesystem_list): Fix more memory leaks on failure.
From Andreas Schwab.
Diffstat (limited to 'lib/mountlist.c')
-rw-r--r--lib/mountlist.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/mountlist.c b/lib/mountlist.c
index 044a77055..28bd220a1 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -287,8 +287,7 @@ fstype_to_string (t)
are automounter (dummy) entries. */
struct mount_entry *
-read_filesystem_list (need_fs_type, all_fs)
- int need_fs_type, all_fs;
+read_filesystem_list (int need_fs_type, int all_fs)
{
struct mount_entry *mount_list;
struct mount_entry *me;
@@ -651,10 +650,13 @@ read_filesystem_list (need_fs_type, all_fs)
{
int saved_errno = errno;
*mtail = NULL;
-
+
while (mount_list)
{
me = mount_list->me_next;
+ free (mount_list->me_devname);
+ free (mount_list->me_mountdir);
+ /* FIXME: me_type is not always malloced. */
free (mount_list);
mount_list = me;
}