summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2022-04-13 14:49:21 +0100
committerRichard Hughes <richard@hughsie.com>2022-04-13 14:54:00 +0100
commit858bc9504392f7bb648ee99c25fec0284dca494b (patch)
treec7d33029b2dfb45d758077874f12a0da241476a4
parent6235bc1a2c5bdcb995760db63f2da61665182ac9 (diff)
downloadappstream-glib-858bc9504392f7bb648ee99c25fec0284dca494b.tar.gz
trivial: Fix a tiny memory leak when mirroring screenshots
-rw-r--r--client/as-util.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/client/as-util.c b/client/as-util.c
index 7ce9e1e..b8b52fc 100644
--- a/client/as-util.c
+++ b/client/as-util.c
@@ -3293,7 +3293,7 @@ as_util_mirror_screenshots_app_file (AsApp *app,
AsImageAlphaFlags alpha_flags;
guint i;
g_autofree gchar *basename = NULL;
- g_autofree gchar *filename_no_path = NULL;
+ g_autofree gchar *filename_no_path = g_path_get_basename (filename);
g_autofree gchar *url_src = NULL;
g_autoptr(AsImage) im_src = NULL;
guint sizes[] = { AS_IMAGE_NORMAL_WIDTH, AS_IMAGE_NORMAL_HEIGHT,
@@ -3308,15 +3308,12 @@ as_util_mirror_screenshots_app_file (AsApp *app,
/* is the aspect ratio of the source perfectly 16:9 */
if ((as_image_get_width (im_src) / 16) * 9 !=
as_image_get_height (im_src)) {
- filename_no_path = g_path_get_basename (filename);
- g_debug ("%s is not in 16:9 aspect ratio",
- filename_no_path);
+ g_debug ("%s is not in 16:9 aspect ratio", filename_no_path);
}
/* check screenshot is reasonable in size */
if (as_image_get_width (im_src) * 2 < AS_IMAGE_NORMAL_WIDTH ||
as_image_get_height (im_src) * 2 < AS_IMAGE_NORMAL_HEIGHT) {
- filename_no_path = g_path_get_basename (filename);
g_set_error (error,
AS_APP_ERROR,
AS_APP_ERROR_FAILED,
@@ -3331,15 +3328,11 @@ as_util_mirror_screenshots_app_file (AsApp *app,
alpha_flags = as_image_get_alpha_flags (im_src);
if ((alpha_flags & AS_IMAGE_ALPHA_FLAG_TOP) > 0||
(alpha_flags & AS_IMAGE_ALPHA_FLAG_BOTTOM) > 0) {
- filename_no_path = g_path_get_basename (filename);
- g_debug ("%s has vertical alpha padding",
- filename_no_path);
+ g_debug ("%s has vertical alpha padding", filename_no_path);
}
if ((alpha_flags & AS_IMAGE_ALPHA_FLAG_LEFT) > 0||
(alpha_flags & AS_IMAGE_ALPHA_FLAG_RIGHT) > 0) {
- filename_no_path = g_path_get_basename (filename);
- g_debug ("%s has horizontal alpha padding",
- filename_no_path);
+ g_debug ("%s has horizontal alpha padding", filename_no_path);
}
/* include the app-id in the basename */