From adce4cfdc6710c3b520f38f64f5f6ee140db4177 Mon Sep 17 00:00:00 2001 From: Ngie Cooper Date: Mon, 12 Dec 2016 23:53:43 -0800 Subject: [PATCH] Free attr, name, and value on memory allocation failure in expat_xmlattr_setup to avoid leaking the storage Reported by: Coverity CID: 1229979-1229981 --- libarchive/archive_read_support_format_xar.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libarchive/archive_read_support_format_xar.c b/libarchive/archive_read_support_format_xar.c index f00e1be70..6a314634f 100644 --- a/libarchive/archive_read_support_format_xar.c +++ b/libarchive/archive_read_support_format_xar.c @@ -3171,6 +3171,9 @@ expat_xmlattr_setup(struct archive_read *a, value = strdup(atts[1]); if (attr == NULL || name == NULL || value == NULL) { archive_set_error(&a->archive, ENOMEM, "Out of memory"); + free(attr); + free(name); + free(value); return (ARCHIVE_FATAL); } attr->name = name; -- 2.47.3