[gnome-color-manager] trivial: Fix up a few memory leaks in the test suite



commit 074f4a75ec4feb42bf6c768ca300c6f122077288
Author: Richard Hughes <richard hughsie com>
Date:   Fri May 21 09:44:23 2010 +0100

    trivial: Fix up a few memory leaks in the test suite

 src/gcm-exif.c      |   10 ++++++++++
 src/gcm-self-test.c |    4 +++-
 2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/gcm-exif.c b/src/gcm-exif.c
index 70d1135..0b186fc 100644
--- a/src/gcm-exif.c
+++ b/src/gcm-exif.c
@@ -93,6 +93,11 @@ gcm_exif_parse_tiff (GcmExif *exif, const gchar *filename, GError **error)
 		goto out;
 	}
 
+	/* free old versions */
+	g_free (priv->manufacturer);
+	g_free (priv->model);
+	g_free (priv->serial);
+
 	/* create copies for ourselves */
 	priv->manufacturer = g_strdup (manufacturer);
 	priv->model = g_strdup (model);
@@ -150,6 +155,11 @@ gcm_exif_parse_jpeg (GcmExif *exif, const gchar *filename, GError **error)
 		goto out;
 	}
 
+	/* free old versions */
+	g_free (priv->manufacturer);
+	g_free (priv->model);
+	g_free (priv->serial);
+
 	/* create copies for ourselves */
 	priv->manufacturer = g_strdup (make);
 	priv->model = g_strdup (model);
diff --git a/src/gcm-self-test.c b/src/gcm-self-test.c
index 9771379..d17ee8e 100644
--- a/src/gcm-self-test.c
+++ b/src/gcm-self-test.c
@@ -345,7 +345,7 @@ gcm_test_device_func (void)
 	GcmDevice *device;
 	gboolean ret;
 	GError *error = NULL;
-	const gchar *filename;
+	gchar *filename;
 	const gchar *profile;
 	gchar *data;
 	gchar **split;
@@ -453,6 +453,7 @@ gcm_test_device_func (void)
 	/* ensure the file is nuked, in case we are running in distcheck */
 	g_unlink (filename);
 	g_main_loop_unref (_loop);
+	g_free (filename);
 
 	g_object_unref (device);
 }
@@ -511,6 +512,7 @@ gcm_test_edid_test_parse_edid_file (GcmEdid *edid, const gchar *datafile, GcmEdi
 	g_assert_cmpfloat (mygamma, <, test_data->gamma + 0.01);
 
 	g_free (filename);
+	g_free (data);
 }
 
 static void



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