From 1a144f35a68df1881d163fccb91444d5da0b7693 Mon Sep 17 00:00:00 2001 From: lillolollo <4179-lillolollo@users.noreply.gitlab.gnome.org> Date: Wed, 3 Sep 2025 12:59:39 +0000 Subject: [PATCH] plug-ins: fix file-exr warning and a possible memory leak --- plug-ins/file-exr/file-exr.c | 3 +++ plug-ins/file-exr/openexr-wrapper.cc | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plug-ins/file-exr/file-exr.c b/plug-ins/file-exr/file-exr.c index f800428244..54922676f9 100644 --- a/plug-ins/file-exr/file-exr.c +++ b/plug-ins/file-exr/file-exr.c @@ -306,6 +306,9 @@ load_image (GFile *file, gimp_image_get_default_new_layer_mode (image)); gimp_image_insert_layer (image, layer, NULL, -1); + if (i > -1) + g_free (layer_name); + buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer)); format = gimp_drawable_get_format (GIMP_DRAWABLE (layer)); bpp = babl_format_get_bytes_per_pixel (format); diff --git a/plug-ins/file-exr/openexr-wrapper.cc b/plug-ins/file-exr/openexr-wrapper.cc index d62515a2e6..26a8e96dea 100644 --- a/plug-ins/file-exr/openexr-wrapper.cc +++ b/plug-ins/file-exr/openexr-wrapper.cc @@ -469,8 +469,8 @@ struct _EXRLoader channels_.layers (layerNames); name = *std::next(layerNames.begin(), index); - result = (gchar *) g_memdup2 (name.c_str () + '\0', - strlen (name.c_str ()) + 1); + result = (gchar *) g_memdup2 (name.c_str(), + name.size() + 1); } return result; }