]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Free attr, name, and value on memory allocation failure in
authorNgie Cooper <yanegomi@gmail.com>
Tue, 13 Dec 2016 07:53:43 +0000 (23:53 -0800)
committerNgie Cooper <yaneurabeya@gmail.com>
Tue, 17 Jan 2017 02:17:53 +0000 (18:17 -0800)
expat_xmlattr_setup to avoid leaking the storage

Reported by: Coverity
CID: 1229979-1229981

libarchive/archive_read_support_format_xar.c

index f00e1be70c11393638143b1d823585b9f5095e79..6a314634f5c5daa06771097764795b87b7f9f973 100644 (file)
@@ -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;