]> gitweb.michael.orlitzky.com - libsvgtiny.git/blobdiff - src/svgtiny.c
Clean up properly
[libsvgtiny.git] / src / svgtiny.c
index 635974f250ac9217f8dc840ec473a1cafe24a6ec..0dd50289bad7ccfeb56887b2f94a9cf93443afe3 100644 (file)
@@ -162,6 +162,7 @@ svgtiny_code svgtiny_parse(struct svgtiny_diagram *diagram,
        dom_string_unref(svg_name);
 
        /* get graphic dimensions */
+       memset(&state, 0, sizeof(state));
        state.diagram = diagram;
        state.document = document;
        state.viewport_width = viewport_width;
@@ -204,10 +205,18 @@ svgtiny_code svgtiny_parse(struct svgtiny_diagram *diagram,
        dom_node_unref(document);
 
 cleanup:
+       if (state.gradient_x1 != NULL)
+               dom_string_unref(state.gradient_x1);
+       if (state.gradient_x2 != NULL)
+               dom_string_unref(state.gradient_x2);
+       if (state.gradient_y1 != NULL)
+               dom_string_unref(state.gradient_y1);
+       if (state.gradient_y2 != NULL)
+               dom_string_unref(state.gradient_y2);
 #define SVGTINY_STRING_ACTION2(s,n)                    \
        if (state.interned_##s != NULL)                 \
                dom_string_unref(state.interned_##s);
-//#include "svgtiny_strings.h"
+#include "svgtiny_strings.h"
 #undef SVGTINY_STRING_ACTION2
        return code;
 }