]> gitweb.michael.orlitzky.com - libsvgtiny.git/commitdiff
src/svgtiny.c: add missing svgtiny_cleanup_state_local() on error path
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 19 Oct 2024 21:53:53 +0000 (17:53 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 20 Oct 2024 21:40:25 +0000 (17:40 -0400)
There's an error path in svgtiny_parse_svg() that leads to returning
svgtiny_LIBDOM_ERROR early. But unlike all of the other early returns
in that function, this one is missing svgtiny_cleanup_state_local().
We add it.

src/svgtiny.c

index 9a6709a7e0069aad5290d43ebad3dcc9067d58a3..3d5cd2cf5c92f82118fad83c24bf8f1eaa56a6de 100644 (file)
@@ -1038,6 +1038,7 @@ svgtiny_code svgtiny_parse_svg(dom_element *svg,
                exc = dom_node_get_node_type(child, &nodetype);
                if (exc != DOM_NO_ERR) {
                        dom_node_unref(child);
+                       svgtiny_cleanup_state_local(&state);
                        return svgtiny_LIBDOM_ERROR;
                }
                if (nodetype == DOM_ELEMENT_NODE) {