From 6f715d2b748cc54b01710409d5f1ceeebe5addfd Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 9 Nov 2016 20:48:22 +0000 Subject: 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. --- libappstream-builder/asb-utils.c | 6 ++++-- 1 file 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); } -- cgit v1.2.1