]> gitweb.michael.orlitzky.com - libsvgtiny.git/blobdiff - svgtiny_test.c
Implement svgtiny_free() and fix memory usage.
[libsvgtiny.git] / svgtiny_test.c
index 9bb7e2e30cdd2e9e50348842c4c8ca68f8694729..8d485d31a1e885c47aa6d478f06e823397425faf 100644 (file)
@@ -40,8 +40,6 @@ int main(int argc, char *argv[])
        }
        size = sb.st_size;
 
-       fprintf(stderr, "size: %lld bytes\n", (long long) size);
-
        buffer = malloc(size);
        if (!buffer) {
                fprintf(stderr, "Unable to allocate %lld bytes\n",
@@ -69,6 +67,8 @@ int main(int argc, char *argv[])
        if (code != svgtiny_OK)
                fprintf(stderr, "svgtiny_parse failed: %i\n", code);
 
+       free(buffer);
+
        printf("viewbox 0 0 %i %i\n", diagram->width, diagram->height);
 
        for (unsigned int i = 0; i != diagram->shape_count; i++) {
@@ -126,6 +126,8 @@ int main(int argc, char *argv[])
                printf("\n");
        }
 
+       svgtiny_free(diagram);
+
        return 0;
 }