void-packages/srcpkgs/alttab/patches/0001-Fix-memleaks-in-error-case.patch
Nathan Owens fd45c92d98 alttab: Add memleaks patch
Signed-off-by: Nathan Owens <ndowens04@gmail.com>
2019-12-03 13:20:27 +01:00

41 lines
1.1 KiB
Diff

From 980bdef0fde36772e283e36a7e12ce28ff1901aa Mon Sep 17 00:00:00 2001
From: Michael Vetter <jubalh@iodoru.org>
Date: Thu, 3 Oct 2019 17:25:19 +0200
Subject: [PATCH] Fix memleaks in error case
We should free img.data.
---
src/pngd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/pngd.c b/src/pngd.c
index ef46621..fb3fd25 100644
--- src/pngd.c
+++ src/pngd.c
@@ -250,6 +250,7 @@ int pngReadToDrawable(char *pngpath, Drawable d, uint8_t bg_red,
fclose(infile);
if (!img.data || img.width == 0 || img.height == 0) {
fprintf(stderr, "error loading png data\n");
+ pngFree(&img);
return 0;
}
if (debug > 0)
@@ -259,6 +260,7 @@ int pngReadToDrawable(char *pngpath, Drawable d, uint8_t bg_red,
pad = 32;
if (!xdata) {
fprintf(stderr, "xdata malloc error\n");
+ pngFree(&img);
return 0;
}
ximage =
@@ -267,6 +269,7 @@ int pngReadToDrawable(char *pngpath, Drawable d, uint8_t bg_red,
if (!ximage) {
fprintf(stderr, "error creating ximage\n");
free(xdata);
+ pngFree(&img);
return 0;
}
ximage->byte_order = MSBFirst;
--
2.24.0