summaryrefslogtreecommitdiff
path: root/libappstream-glib/as-image.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2017-06-22 16:20:51 +0100
committerRichard Hughes <richard@hughsie.com>2017-06-22 16:20:51 +0100
commit26d268b6bb005ba983bb8ab07b4b287ea66639f8 (patch)
tree24fc3d5783a6fd6ec8dd9a776266b75b970af69a /libappstream-glib/as-image.c
parentdf2531febeaa7bdfcd86ef2e0c37eca13efe46d4 (diff)
downloadappstream-glib-26d268b6bb005ba983bb8ab07b4b287ea66639f8.tar.gz
trivial: Fix up several small memory leaks
Diffstat (limited to 'libappstream-glib/as-image.c')
-rw-r--r--libappstream-glib/as-image.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libappstream-glib/as-image.c b/libappstream-glib/as-image.c
index c101c61..55067e5 100644
--- a/libappstream-glib/as-image.c
+++ b/libappstream-glib/as-image.c
@@ -534,6 +534,7 @@ as_image_load_filename_full (AsImage *image,
/* only support non-deprecated types */
if (flags & AS_IMAGE_LOAD_FLAG_ONLY_SUPPORTED) {
GdkPixbufFormat *fmt;
+ g_autofree gchar *name = NULL;
fmt = gdk_pixbuf_get_file_info (filename, NULL, NULL);
if (fmt == NULL) {
g_set_error_literal (error,
@@ -542,15 +543,16 @@ as_image_load_filename_full (AsImage *image,
"image format was not recognized");
return FALSE;
}
- if (g_strcmp0 (gdk_pixbuf_format_get_name (fmt), "png") != 0 &&
- g_strcmp0 (gdk_pixbuf_format_get_name (fmt), "jpeg") != 0 &&
- g_strcmp0 (gdk_pixbuf_format_get_name (fmt), "xpm") != 0 &&
- g_strcmp0 (gdk_pixbuf_format_get_name (fmt), "svg") != 0) {
+ name = gdk_pixbuf_format_get_name (fmt);
+ if (g_strcmp0 (name, "png") != 0 &&
+ g_strcmp0 (name, "jpeg") != 0 &&
+ g_strcmp0 (name, "xpm") != 0 &&
+ g_strcmp0 (name, "svg") != 0) {
g_set_error (error,
AS_UTILS_ERROR,
AS_UTILS_ERROR_FAILED,
"image format %s is not supported",
- gdk_pixbuf_format_get_name (fmt));
+ name);
return FALSE;
}
}