|
|
ecdf9b |
From 59811406ccd626704a0bb810032c39a089e1965a Mon Sep 17 00:00:00 2001
|
|
|
ecdf9b |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
ecdf9b |
Date: Thu, 13 Jun 2013 14:18:52 +0200
|
|
|
ecdf9b |
Subject: [PATCH 15/35] cheese-camera-device: Plug some memory leaks
|
|
|
ecdf9b |
|
|
|
ecdf9b |
1) If we already have a format in the list, free it
|
|
|
ecdf9b |
2) Not only free the formats in the list, but also the actual GList structures
|
|
|
ecdf9b |
themselves
|
|
|
ecdf9b |
|
|
|
ecdf9b |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
ecdf9b |
---
|
|
|
ecdf9b |
libcheese/cheese-camera-device.c | 5 +++--
|
|
|
ecdf9b |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
ecdf9b |
|
|
|
ecdf9b |
diff --git a/libcheese/cheese-camera-device.c b/libcheese/cheese-camera-device.c
|
|
|
ecdf9b |
index 402bbb8..a12b0f7 100644
|
|
|
ecdf9b |
--- a/libcheese/cheese-camera-device.c
|
|
|
ecdf9b |
+++ b/libcheese/cheese-camera-device.c
|
|
|
ecdf9b |
@@ -360,6 +360,7 @@ cheese_camera_device_add_format (CheeseCameraDevice *device,
|
|
|
ecdf9b |
(CheeseVideoFormat *)format);
|
|
|
ecdf9b |
if (existing)
|
|
|
ecdf9b |
{
|
|
|
ecdf9b |
+ g_slice_free (CheeseVideoFormatFull, format);
|
|
|
ecdf9b |
cheese_camera_device_format_update_framerate (existing, framerate);
|
|
|
ecdf9b |
return;
|
|
|
ecdf9b |
}
|
|
|
ecdf9b |
@@ -380,7 +381,7 @@ cheese_camera_device_add_format (CheeseCameraDevice *device,
|
|
|
ecdf9b |
* Free the individual #CheeseVideoFormatFull.
|
|
|
ecdf9b |
*/
|
|
|
ecdf9b |
static void
|
|
|
ecdf9b |
-free_format_list_foreach (gpointer data, G_GNUC_UNUSED gpointer user_data)
|
|
|
ecdf9b |
+free_format_list_foreach (gpointer data)
|
|
|
ecdf9b |
{
|
|
|
ecdf9b |
g_slice_free (CheeseVideoFormatFull, data);
|
|
|
ecdf9b |
}
|
|
|
ecdf9b |
@@ -396,7 +397,7 @@ free_format_list (CheeseCameraDevice *device)
|
|
|
ecdf9b |
{
|
|
|
ecdf9b |
CheeseCameraDevicePrivate *priv = device->priv;
|
|
|
ecdf9b |
|
|
|
ecdf9b |
- g_list_foreach (priv->formats, free_format_list_foreach, NULL);
|
|
|
ecdf9b |
+ g_list_free_full (priv->formats, free_format_list_foreach);
|
|
|
ecdf9b |
priv->formats = NULL;
|
|
|
ecdf9b |
}
|
|
|
ecdf9b |
|
|
|
ecdf9b |
--
|
|
|
ecdf9b |
1.8.2.1
|
|
|
ecdf9b |
|