1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-15 19:56:55 +00:00

lua-imlib2: fix memory leak

If you frequently use this function to draw new images this leak
becomes quite significant
This commit is contained in:
Simon Lees 2024-11-18 12:17:09 +10:30 committed by Brenden Matthews
parent a0ee703ee2
commit 9449818c4d

View File

@ -5,7 +5,7 @@
* Please see COPYING for details
*
* Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.
* (see AUTHORS)
* (see AUTHORS)
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
@ -61,7 +61,6 @@ void cairo_place_image(const char *file, cairo_t *cr, int x, int y,
return;
}
/* create scaled version of image to later extract the alpha channel */
alpha_image = imlib_create_cropped_scaled_image(0, 0, w, h, width, height);
/* create temporary image */
@ -151,6 +150,8 @@ void cairo_draw_image(const char *file, cairo_surface_t *cs, int x, int y,
cr = cairo_create(cs);
cairo_place_image(file, cr, x, y, scaled_w, scaled_h, 1.0);
imlib_context_set_image(image);
imlib_free_image_and_decache();
cairo_destroy(cr);
}