summaryrefslogtreecommitdiffstats
path: root/src/appliance.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-08-23 19:50:11 +0100
committerRichard W.M. Jones <rjones@redhat.com>2011-08-23 19:50:11 +0100
commitce18be33cd5279a8d4120eedd037400c275585c0 (patch)
tree40fc1c82f49de130625494e6ca51d9fe6e17bbe1 /src/appliance.c
parenta31ac8fc32297cc9185fd20a5578d2bc81cc1bce (diff)
downloadlibguestfs-ce18be33cd5279a8d4120eedd037400c275585c0.tar.gz
libguestfs-ce18be33cd5279a8d4120eedd037400c275585c0.tar.xz
libguestfs-ce18be33cd5279a8d4120eedd037400c275585c0.zip
Coverity: fix memory leak along error path.
Diffstat (limited to 'src/appliance.c')
-rw-r--r--src/appliance.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/appliance.c b/src/appliance.c
index 9f869540..836e6792 100644
--- a/src/appliance.c
+++ b/src/appliance.c
@@ -402,6 +402,12 @@ check_for_cached_appliance (guestfs_h *g,
/* Releases the lock on checksum. */
if (close (fd) == -1) {
perrorf (g, "close");
+ /* Allocated in hard_link_to_cached_appliance above, must be
+ * freed along this error path.
+ */
+ free (*kernel);
+ free (*initrd);
+ free (*appliance);
return -1;
}
@@ -540,6 +546,12 @@ build_supermin_appliance (guestfs_h *g,
/* Releases the lock on checksum. */
if (close (fd) == -1) {
perrorf (g, "close");
+ /* Allocated in hard_link_to_cached_appliance above, must be
+ * freed along this error path.
+ */
+ free (*kernel);
+ free (*initrd);
+ free (*appliance);
return -1;
}