X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=io-svg.c;h=543162f6c0b21f8357679f3e03ce76f408e91da9;hb=96deefceb53d73852b56ca0c71c08ba9abc758ca;hp=5f57689902e9d3830d799f0646f1b74c4425dfff;hpb=4b0f9dfd8a71a23e5c57b715945a9dccfb9ad6dc;p=libsvgtiny-pixbuf.git diff --git a/io-svg.c b/io-svg.c index 5f57689..543162f 100644 --- a/io-svg.c +++ b/io-svg.c @@ -131,7 +131,6 @@ static diagram_t* svgtiny_diagram_from_buffer(char* buffer, } code = svgtiny_parse(diagram, buffer, bytecount, "", width, height); - free(buffer); if (code != svgtiny_OK) { switch (code) { @@ -340,8 +339,7 @@ static gpointer gdk_pixbuf_begin_load(GdkPixbufModuleSizeFunc size_func, context->updated_func = updated_func; context->user_data = user_data; - /* YOLO, no error checking */ - context->svg_data = g_malloc(0); + context->svg_data = NULL; context->svg_data_size = 0; return context; @@ -381,17 +379,6 @@ static void emit_prepared(SvgTinyContext* context, GdkPixbuf* pixbuf) { } -/* -static void emit_size(SvgTinyContext* context, GdkPixbuf* pixbuf) { - int w = gdk_pixbuf_get_width(pixbuf); - int h = gdk_pixbuf_get_height(pixbuf); - if (context->size_func != NULL) { - (*context->size_func)(&w, &h, context->user_data); - } -} -*/ - - static gboolean gdk_pixbuf_stop_load(gpointer data, GError **error) { SvgTinyContext* context = (SvgTinyContext*)data; GdkPixbuf* pixbuf = NULL; @@ -403,7 +390,6 @@ static gboolean gdk_pixbuf_stop_load(gpointer data, GError **error) { &sub_error); if (pixbuf != NULL) { - /*emit_size(context, pixbuf);*/ emit_prepared(context, pixbuf); emit_updated(context, pixbuf); g_object_unref(pixbuf); @@ -412,6 +398,7 @@ static gboolean gdk_pixbuf_stop_load(gpointer data, GError **error) { g_propagate_error(error, sub_error); result = FALSE; } + g_free(context->svg_data); g_free(context); return result;