]> granicus.if.org Git - libexpat/commitdiff
Remove memory leak in external_entity_optioner()
authorRhodri James <rhodri@kynesim.co.uk>
Thu, 27 Jul 2017 10:50:15 +0000 (11:50 +0100)
committerRhodri James <rhodri@kynesim.co.uk>
Thu, 27 Jul 2017 10:50:15 +0000 (11:50 +0100)
expat/tests/runtests.c

index 669b665d4b1ad1677a84d4f0445fbe8922bcf087..51930cb0d4e290be5874079736544842f1d06f67 100644 (file)
@@ -339,16 +339,16 @@ external_entity_optioner(XML_Parser parser,
 
     while (options->parse_text != NULL) {
         if (!strcmp(systemId, options->system_id)) {
+            enum XML_Status rc;
             ext_parser =
                 XML_ExternalEntityParserCreate(parser, context, NULL);
             if (ext_parser == NULL)
                 return XML_STATUS_ERROR;
-            if (_XML_Parse_SINGLE_BYTES(ext_parser, options->parse_text,
-                                        strlen(options->parse_text),
-                                        XML_TRUE) == XML_STATUS_ERROR)
-                return XML_STATUS_ERROR;
+            rc = _XML_Parse_SINGLE_BYTES(ext_parser, options->parse_text,
+                                         strlen(options->parse_text),
+                                         XML_TRUE);
             XML_ParserFree(ext_parser);
-            return XML_STATUS_OK;
+            return rc;
         }
         options++;
     }