summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2008-08-17 22:56:13 +0200
committerGravatar Jonathan Beck2008-08-21 19:13:35 +0200
commitd5e52dbdfd46fd15e47e006590573902fcc3bbed (patch)
tree9ae6c2af67a4e8bf5d59079fffe5238fad3fd9c7 /src/main.c
parent89f0fd84b2c56e78c080ad4420b541eb8c96a9f2 (diff)
downloadlibimobiledevice-d5e52dbdfd46fd15e47e006590573902fcc3bbed.tar.gz
libimobiledevice-d5e52dbdfd46fd15e47e006590573902fcc3bbed.tar.bz2
fix AFC memory leak and errors (from iphoneclient valgrind analysis).
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index f7f8a2c..42600c3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -66,17 +66,18 @@ int main(int argc, char *argv[]) {
dirs = afc_get_dir_list(afc, "/eafaedf");
if (!dirs) dirs = afc_get_dir_list(afc, "/");
printf("Directory time.\n");
- for (i = 0; strcmp(dirs[i], ""); i++) {
+ for (i = 0; dirs[i]; i++) {
printf("/%s\n", dirs[i]);
}
- free_dictionary(dirs);
+ g_strfreev(dirs);
dirs = afc_get_devinfo(afc);
if (dirs) {
- for (i = 0; strcmp(dirs[i], ""); i+=2) {
+ for (i = 0; dirs[i]; i+=2) {
printf("%s: %s\n", dirs[i], dirs[i+1]);
}
}
+ g_strfreev(dirs);
AFCFile *my_file = afc_open_file(afc, "/iTunesOnTheGoPlaylist.plist", AFC_FILE_READ);
if (my_file) {
@@ -124,6 +125,7 @@ int main(int argc, char *argv[]) {
else printf("Couldn't read!\n");
free(threeletterword);
afc_close_file(afc, my_file);
+ free(my_file);
}
afc_disconnect(afc);