From 16cdf8dfe6e0fd5af19812c31d64cdccdd6b823f Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 24 Jul 2024 20:06:15 +0800 Subject: [PATCH] * src/image.c (gui_put_x_image): Avoid memory leak. (cherry picked from commit 23549d7175108ca632375f9cc4390ff3e53e4d1e) --- src/image.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/image.c b/src/image.c index 9d97337fd31..1b26af05351 100644 --- a/src/image.c +++ b/src/image.c @@ -4177,7 +4177,7 @@ static void gui_put_x_image (struct frame *f, Emacs_Pix_Container pimg, Emacs_Pixmap pixmap, int width, int height) { -#if defined USE_CAIRO || defined HAVE_HAIKU +#if defined USE_CAIRO || defined HAVE_HAIKU || defined HAVE_NS eassert (pimg == pixmap); #elif defined HAVE_X_WINDOWS GC gc; @@ -4189,12 +4189,7 @@ gui_put_x_image (struct frame *f, Emacs_Pix_Container pimg, XFreeGC (FRAME_X_DISPLAY (f), gc); #elif defined HAVE_ANDROID android_put_image (pixmap, pimg); -#endif - -#ifdef HAVE_NS - eassert (pimg == pixmap); - ns_retain_object (pimg); -#endif +#endif /* HAVE_ANDROID */ } /* Thin wrapper for image_create_x_image_and_pixmap_1, so that it matches -- 2.39.2