[tracker/tracker-0.10] tracker-extract,albumart: Plug a leak



commit f8bcd62ea1c155b1bc0f2829921716cec84f8080
Author: Carlos Garnacho <carlos lanedo com>
Date:   Fri Nov 25 12:26:45 2011 +0100

    tracker-extract,albumart: Plug a leak
    
    The pixbuf loader was being leaked, whereas the pixbuf
    was being unref'ed, even though it's owned by the loader.

 src/tracker-extract/tracker-albumart-pixbuf.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker-extract/tracker-albumart-pixbuf.c b/src/tracker-extract/tracker-albumart-pixbuf.c
index cd943a6..49412af 100644
--- a/src/tracker-extract/tracker-albumart-pixbuf.c
+++ b/src/tracker-extract/tracker-albumart-pixbuf.c
@@ -92,6 +92,7 @@ tracker_albumart_buffer_to_jpeg (const unsigned char *buffer,
 
 			g_clear_error (&error);
 			gdk_pixbuf_loader_close (loader, NULL);
+			g_object_unref (loader);
 
 			return FALSE;
 		}
@@ -102,6 +103,7 @@ tracker_albumart_buffer_to_jpeg (const unsigned char *buffer,
 			g_warning ("Could not get pixbuf from GdkPixbufLoader when setting album art");
 
 			gdk_pixbuf_loader_close (loader, NULL);
+			g_object_unref (loader);
 
 			return FALSE;
 		}
@@ -111,19 +113,19 @@ tracker_albumart_buffer_to_jpeg (const unsigned char *buffer,
 			           error ? error->message : "no error given");
 
 			g_clear_error (&error);
-			g_object_unref (pixbuf);
 			gdk_pixbuf_loader_close (loader, NULL);
+			g_object_unref (loader);
 
 			return FALSE;
 		}
 
-		g_object_unref (pixbuf);
-
 		if (!gdk_pixbuf_loader_close (loader, &error)) {
 			g_warning ("Could not close GdkPixbufLoader when setting album art, %s",
 			           error ? error->message : "no error given");
 			g_clear_error (&error);
 		}
+
+		g_object_unref (loader);
 	}
 
 	return TRUE;



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