Fix a memory leak on image loading

This commit is contained in:
Přemysl Eric Janouch 2023-04-14 07:33:28 +02:00
parent a012011631
commit eb44b6fb91
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 4 additions and 1 deletions

View File

@ -2754,7 +2754,10 @@ fiv_io_open(const FivIoOpenContext *ctx, GError **error)
gchar *data = NULL;
gsize len = 0;
if (!g_file_load_contents(file, NULL, &data, &len, NULL, error))
gboolean success =
g_file_load_contents(file, NULL, &data, &len, NULL, error);
g_object_unref(file);
if (!success)
return NULL;
cairo_surface_t *surface = fiv_io_open_from_data(data, len, ctx, error);