aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-04-14 07:33:28 +0200
committerPřemysl Eric Janouch <p@janouch.name>2023-04-14 07:34:26 +0200
commiteb44b6fb91e5d4edbeb7cbb86a734836ed143cb8 (patch)
tree2eec9b65a6ba8e6b1df05e1f9f161bf5647c2595
parenta012011631a04c79e283b494acf91706bfb48f43 (diff)
downloadfiv-eb44b6fb91e5d4edbeb7cbb86a734836ed143cb8.tar.gz
fiv-eb44b6fb91e5d4edbeb7cbb86a734836ed143cb8.tar.xz
fiv-eb44b6fb91e5d4edbeb7cbb86a734836ed143cb8.zip
Fix a memory leak on image loading
-rw-r--r--fiv-io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fiv-io.c b/fiv-io.c
index c4914a2..004debb 100644
--- a/fiv-io.c
+++ b/fiv-io.c
@@ -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);