summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2014-07-13 19:16:42 +0100
committerPádraig Brady <P@draigBrady.com>2014-07-13 21:03:57 +0100
commitdbd7c9452a121f948b4eabbe22e07ad13900bc9b (patch)
tree1a6712bf5b12e49185d97537100cb1465b62a97b
parent4d82df724ef1ee0809aa294c68f7cc11c9c0f0f5 (diff)
downloadcoreutils-dbd7c9452a121f948b4eabbe22e07ad13900bc9b.tar.gz
maint: avoid an inconsequential mem leak
* src/df.c (get_disk): Avoid an inconsequential mem leak spotted by coverity. Also s/duplicities/duplicates/.
-rw-r--r--src/df.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/df.c b/src/df.c
index 063cabf30..3ef5d33b0 100644
--- 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;
}