From: Ngie Cooper Date: Tue, 13 Dec 2016 07:53:43 +0000 (-0800) Subject: Free attr, name, and value on memory allocation failure in X-Git-Tag: v3.3.0~37^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adce4cfdc6710c3b520f38f64f5f6ee140db4177;p=thirdparty%2Flibarchive.git Free attr, name, and value on memory allocation failure in expat_xmlattr_setup to avoid leaking the storage Reported by: Coverity CID: 1229979-1229981 --- 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;