From 3135b8c378f9f98ae66e37fd79d305764334980d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 8 Jun 2011 22:16:59 +0100 Subject: [PATCH] Coverity: Don't leak error strings. --- daemon/blockdev.c | 2 ++ daemon/fsck.c | 1 + daemon/mount.c | 2 ++ daemon/ntfs.c | 3 +++ daemon/parted.c | 9 ++++++--- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/daemon/blockdev.c b/daemon/blockdev.c index 3df1807..1afb4b8 100644 --- a/daemon/blockdev.c +++ b/daemon/blockdev.c @@ -68,11 +68,13 @@ call_blockdev (const char *device, const char *switc, int extraarg, int prints) if (sscanf (out, "%" SCNi64, &rv) != 1) { reply_with_error ("%s: expected output, but got nothing", argv[0]); free (out); + free (err); return -1; } } free (out); + free (err); return rv; } diff --git a/daemon/fsck.c b/daemon/fsck.c index e452adc..7a36440 100644 --- a/daemon/fsck.c +++ b/daemon/fsck.c @@ -39,5 +39,6 @@ do_fsck (const char *fstype, const char *device) return -1; } + free (err); return r; } diff --git a/daemon/mount.c b/daemon/mount.c index 098283a..be289da 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -116,6 +116,7 @@ do_mount_vfs (const char *options, const char *vfstype, return -1; } + free (error); return 0; } @@ -367,6 +368,7 @@ do_mount_loop (const char *file, const char *mountpoint) return -1; } + free (error); return 0; } diff --git a/daemon/ntfs.c b/daemon/ntfs.c index a25fc38..909ea18 100644 --- a/daemon/ntfs.c +++ b/daemon/ntfs.c @@ -56,6 +56,7 @@ do_ntfs_3g_probe (int rw, const char *device) return -1; } + free (err); return r; } @@ -72,6 +73,7 @@ do_ntfsresize (const char *device) return -1; } + free (err); return 0; } @@ -92,5 +94,6 @@ do_ntfsresize_size (const char *device, int64_t size) return -1; } + free (err); return 0; } diff --git a/daemon/parted.c b/daemon/parted.c index b9b138e..d52ad2c 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -292,13 +292,16 @@ test_parted_m_opt (void) if (r == -1) { /* Test failed, eg. missing or completely unusable parted binary. */ reply_with_error ("could not run 'parted' command"); + free (err); return -1; } if (err && strstr (err, "invalid option -- m")) - return result = 0; - - return result = 1; + result = 0; + else + result = 1; + free (err); + return result; } static char * -- 1.8.3.1