]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: avoid an inconsequential mem leak
authorPádraig Brady <P@draigBrady.com>
Sun, 13 Jul 2014 18:16:42 +0000 (19:16 +0100)
committerPádraig Brady <P@draigBrady.com>
Sun, 13 Jul 2014 20:03:57 +0000 (21:03 +0100)
* src/df.c (get_disk): Avoid an inconsequential mem leak
spotted by coverity.  Also s/duplicities/duplicates/.

src/df.c

index 063cabf30099f031472eae1a4f5c3f86cdc9181a..3ef5d33b0cd0b8353f74c6546c061e76c4a944d3 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -44,7 +44,7 @@
   proper_name ("Paul Eggert")
 
 /* Filled with device numbers of examined file systems to avoid
-   duplicities in output.  */
+   duplicates in output.  */
 static struct devlist
 {
   dev_t dev_num;
@@ -604,7 +604,7 @@ excluded_fstype (const char *fstype)
 }
 
 /* Filter mount list by skipping duplicate entries.
-   In the case of duplicities - based on the device number - the mount entry
+   In the case of duplicates - based on the device number - the mount entry
    with a '/' in its me_devname (i.e. not pseudo name like tmpfs) wins.
    If both have a real devname (e.g. bind mounts), then that with the shorter
    me_mountdir wins.  With DEVICES_ONLY == true (set with df -a), only update
@@ -1185,7 +1185,11 @@ get_disk (char const *disk)
                 {
                   best_match = me;
                   if (len == 1) /* Traditional root.  */
-                    break;
+                    {
+                      free (last_device);
+                      free (canon_dev);
+                      break;
+                    }
                   else
                     best_match_len = len;
                 }