From 9f37b04d0189a7d9f9fa7b7d58ce7ccb1d728ea1 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Wed, 9 Mar 2016 21:05:50 +1100 Subject: [PATCH] fix a context object reference leak from upgrading a paletted image The internal process of upgrading a paletted image to a direct image, done when a color not in the palette is written to the image, no long leaks a reference count to the context object. --- palimg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/palimg.c b/palimg.c index b32c0d49..0c37b582 100644 --- a/palimg.c +++ b/palimg.c @@ -205,10 +205,12 @@ i_img_to_rgb_inplace(i_img *im) { i_img_rgb_convert(&temp, im); /* nasty hack */ - (im->i_f_destroy)(im); - myfree(im->idata); + i_img_exorcise(im); *im = temp; + /* i_img_empty_ch() calls i_img_init() which takes a ref */ + im_context_refdec(aIMCTX, "img_destroy"); + return 1; } -- 2.39.5