summaryrefslogtreecommitdiffstats
path: root/src/plist.c
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2008-08-17 22:15:44 +0200
committerGravatar Jonathan Beck2008-08-21 19:13:35 +0200
commitef6206f51596d3c643dc0efe441ecaa0159f5632 (patch)
tree869cb749fcfdb1b06d5ee76f103ac72a72575e05 /src/plist.c
parentab38ab2ec7166f35aa0b8943d0b9f020c514e024 (diff)
downloadlibimobiledevice-ef6206f51596d3c643dc0efe441ecaa0159f5632.tar.gz
libimobiledevice-ef6206f51596d3c643dc0efe441ecaa0159f5632.tar.bz2
use NULL at end of dictionary values (fixes a memory leak).
Diffstat (limited to 'src/plist.c')
-rw-r--r--src/plist.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plist.c b/src/plist.c
index e64cff2..31490d0 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -212,7 +212,7 @@ char **read_dict_element_strings(xmlNode *dict) {
old = return_me;
return_me = realloc(return_me, sizeof(char*) * (current_length+1));
- return_me[current_pos] = strdup("");
+ return_me[current_pos] = NULL;
return return_me;
}
@@ -224,11 +224,10 @@ void free_dictionary(char **dictionary) {
if (!dictionary) return;
- for (i = 0; strcmp(dictionary[i], ""); i++) {
+ for (i = 0; dictionary[i]; i++) {
free(dictionary[i]);
}
-
- free(dictionary[i]);
+
free(dictionary);
}