[PATCH 3/6] Fix a memory leak by freeing the result of gdk_pixbuf_format_get_name()



---
 src/vncdisplay.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index d20e695..d900943 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -1281,7 +1281,13 @@ static gboolean check_pixbuf_support(const char *name)
 
 	for (i = list; i; i = i->next) {
 		GdkPixbufFormat *fmt = i->data;
-		if (!strcmp(gdk_pixbuf_format_get_name(fmt), name))
+		gchar *fmt_name = gdk_pixbuf_format_get_name(fmt);
+		int cmp;
+
+		cmp = strcmp(fmt_name, name);
+		g_free (fmt_name);
+
+		if (!cmp)
 			break;
 	}
 
-- 
1.6.3.3


--=-ZGLsREbMdlUqAwJTGqis
Content-Disposition: attachment; filename*0=0004-Fix-a-memory-leak-by-freeing-a-GdkGC-private-variabl.pat; filename*1=ch
Content-Type: text/x-patch; name="0004-Fix-a-memory-leak-by-freeing-a-GdkGC-private-variabl.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]