diff options
author | Jonathan Beck | 2008-08-17 22:56:13 +0200 |
---|---|---|
committer | Jonathan Beck | 2008-08-21 19:13:35 +0200 |
commit | d5e52dbdfd46fd15e47e006590573902fcc3bbed (patch) | |
tree | 9ae6c2af67a4e8bf5d59079fffe5238fad3fd9c7 /src/main.c | |
parent | 89f0fd84b2c56e78c080ad4420b541eb8c96a9f2 (diff) | |
download | libplist-d5e52dbdfd46fd15e47e006590573902fcc3bbed.tar.gz libplist-d5e52dbdfd46fd15e47e006590573902fcc3bbed.tar.bz2 |
fix AFC memory leak and errors (from iphoneclient valgrind analysis).
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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); |