summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-11-09 20:48:22 +0000
committerRichard Hughes <richard@hughsie.com>2017-01-17 10:36:20 +0000
commit6f715d2b748cc54b01710409d5f1ceeebe5addfd (patch)
tree88b927ac49a1685c9d7540c64b65e91ab2fe4089
parent2f94805994e9dea9bcc60e3fd1c7d3b5f226d755 (diff)
downloadappstream-glib-6f715d2b748cc54b01710409d5f1ceeebe5addfd.tar.gz
trivial: Do not leak the entry if the file cannot be read
I'm not sure how you can hit this, but it was noticed by Coverity.
-rw-r--r--libappstream-builder/asb-utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libappstream-builder/asb-utils.c b/libappstream-builder/asb-utils.c
index 6615711..2a8c870 100644
--- a/libappstream-builder/asb-utils.c
+++ b/libappstream-builder/asb-utils.c
@@ -444,8 +444,10 @@ asb_utils_write_archive (const gchar *filename,
archive_entry_set_perm (entry, 0644);
archive_write_header (a, entry);
ret = g_file_get_contents (filename_full, &data, &len, error);
- if (!ret)
- goto out;
+ if (!ret) {
+ archive_entry_free (entry);
+ break;
+ }
archive_write_data (a, data, len);
archive_entry_free (entry);
}