aboutsummaryrefslogtreecommitdiff
blob: ee7f8d9964f078872993fc009a3df7f08fac7381 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From 1302e611dcd0d081fe1adf92b162aed16561dc8d Mon Sep 17 00:00:00 2001
From: Danny Kukawka <danny.kukawka@web.de>
Date: Tue, 17 Jun 2008 19:54:50 +0200
Subject: [PATCH 05/48] fixed memory leaks related to usage of g_strsplit

Fixed two memory leaks related to usage of g_strsplit, free
returned char** after usage with g_strfreev() as pointed out
by Tomasz Ostrowski in fd.o #16376.
---
 hald/hald_dbus.c    |    3 ++-
 hald/linux/device.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hald/hald_dbus.c b/hald/hald_dbus.c
index 819ab9c..6889275 100644
--- a/hald/hald_dbus.c
+++ b/hald/hald_dbus.c
@@ -4679,7 +4679,7 @@ do_introspect (DBusConnection  *connection,
 					const char *name;
 					const char *sig;
 					const char *argnames;
-					char **args;
+					gchar **args;
 					unsigned int n;
 					unsigned int m;
 
@@ -4722,6 +4722,7 @@ do_introspect (DBusConnection  *connection,
 						xml, 
 						"    </method>\n");
 
+					g_strfreev(args);
 				}
 				
 
diff --git a/hald/linux/device.c b/hald/linux/device.c
index cf884e1..8bbe949 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -93,7 +93,7 @@ static int
 input_str_to_bitmask (const char *s, long *bitmask, size_t max_size)
 {
 	int i, j;
-	char **v;
+	gchar **v;
 	int num_bits_set = 0;
 
 	memset (bitmask, 0, max_size);
@@ -109,6 +109,7 @@ input_str_to_bitmask (const char *s, long *bitmask, size_t max_size)
 			val &= (val - 1);
 		}
 	}
+	g_strfreev(v);
 
 	return num_bits_set;
 }
-- 
1.6.1.2