[PATCH 4/6] Fixed a memory leak related to the satelite icon

Lubomir I. Ivanov neolit123 at gmail.com
Sat Feb 9 11:29:59 PST 2013


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

divelist.c:get_gps_icon_for_dive()
In all callers of the function use gdk_pixbuf_unref() to
release the returned GdkPixbuf (but also check for NULL).

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
 divelist.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/divelist.c b/divelist.c
index 0b5e624..288b787 100644
--- a/divelist.c
+++ b/divelist.c
@@ -921,6 +921,8 @@ static void fill_one_dive(struct dive *dive,
 		DIVE_SUIT, suit,
 		-1);
 
+	if (icon)
+		gdk_pixbuf_unref(icon);
 	free(location);
 	free(cylinder);
 	free(suit);
@@ -1325,6 +1327,8 @@ static void fill_dive_list(void)
 			DIVE_TEMPERATURE, dive->watertemp.mkelvin,
 			DIVE_SAC, 0,
 			-1);
+		if (icon)
+			gdk_pixbuf_unref(icon);
 		gtk_tree_store_append(liststore, &iter, NULL);
 		gtk_tree_store_set(liststore, &iter,
 			DIVE_INDEX, i,
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list