resources: Plug a mem leak

==29204== 7,192 (76 direct, 7,116 indirect) bytes in 1 blocks are definitely lost in loss record 855 of 861
==29204==    at 0x402AD89: malloc (vg_replace_malloc.c:236)
==29204==    by 0x4084724: standard_malloc (gmem.c:85)
==29204==    by 0x40847C7: g_malloc (gmem.c:159)
==29204==    by 0x409B1E1: g_slice_alloc (gslice.c:1003)
==29204==    by 0x409B227: g_slice_alloc0 (gslice.c:1029)
==29204==    by 0x41936CF: g_type_create_instance (gtype.c:1872)
==29204==    by 0x417CCC9: g_object_constructor (gobject.c:1839)
==29204==    by 0x417C6F4: g_object_newv (gobject.c:1703)
==29204==    by 0x417CC5A: g_object_new_valist (gobject.c:1820)
==29204==    by 0x417C1DB: g_object_new (gobject.c:1535)
==29204==    by 0x424E815: g_zlib_decompressor_new (gzlibdecompressor.c:270)
==29204==    by 0x4228DD8: g_resource_lookup_data (gresource.c:422)
This commit is contained in:
Christian Persch 2012-02-05 16:18:34 +01:00
parent e194a9032f
commit 30e9cccb85

View File

@ -441,6 +441,8 @@ g_resource_lookup_data (GResource *resource,
if (res == G_CONVERTER_ERROR)
{
g_free (uncompressed);
g_object_unref (decompressor);
g_set_error (error, G_RESOURCE_ERROR, G_RESOURCE_ERROR_INTERNAL,
_("The resource at '%s' failed to decompress"),
path);
@ -456,6 +458,8 @@ g_resource_lookup_data (GResource *resource,
uncompressed[size] = 0; /* Zero terminate */
g_object_unref (decompressor);
return g_bytes_new_take (uncompressed, size);
}
else