summaryrefslogtreecommitdiff
path: root/background-image.c
diff options
context:
space:
mode:
authorManuel Stoeckl <code@mstoeckl.com>2022-03-04 19:02:25 -0500
committerSimon Ser <contact@emersion.fr>2022-03-05 09:47:31 +0100
commit94f41dafd925ab2ff0dbbd3a7d47968d8ad12ffe (patch)
tree45aac74d02c99317239da5a188bfdecaf5fd607c /background-image.c
parent3874badf94ada966ca0ac3a8c1fa1e4e915a76d3 (diff)
downloadswaybg-94f41dafd925ab2ff0dbbd3a7d47968d8ad12ffe.tar.gz
swaybg-94f41dafd925ab2ff0dbbd3a7d47968d8ad12ffe.tar.bz2
Fix memory leak when using image tile mode
cairo_pattern_t and cairo_surface_t are both reference counted; before this change, `pattern` being leaked kept alive an extra reference to the image to which it referred, thereby leaking the image as well.
Diffstat (limited to 'background-image.c')
-rw-r--r--background-image.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/background-image.c b/background-image.c
index 26cb6ee..53d1b63 100644
--- a/background-image.c
+++ b/background-image.c
@@ -108,6 +108,7 @@ void render_background_image(cairo_t *cairo, cairo_surface_t *image,
cairo_pattern_t *pattern = cairo_pattern_create_for_surface(image);
cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
cairo_set_source(cairo, pattern);
+ cairo_pattern_destroy(pattern);
break;
}
case BACKGROUND_MODE_SOLID_COLOR: