diff options
author | Richard Hughes <richard@hughsie.com> | 2016-11-09 20:48:22 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2016-11-09 20:48:22 +0000 |
commit | 88eecd2280754f1602bbaf58af020be5672e5a0c (patch) | |
tree | 186df014b580c39cee00466a6ab3c63485cba1af | |
parent | 1c309839246900f73a203f84aa5380ea2746b360 (diff) | |
download | appstream-glib-88eecd2280754f1602bbaf58af020be5672e5a0c.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.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libappstream-builder/asb-utils.c b/libappstream-builder/asb-utils.c index 4bb5e58..81f1525 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); } |