Index: examples/filetree.c |
diff --git a/examples/filetree.c b/examples/filetree.c |
index 234d09321b90ca67a642eef285d213beb50ba56f..6d6ed81905ff74fc15e3045c73ff8f38d2456c31 100644 |
--- a/examples/filetree.c |
+++ b/examples/filetree.c |
@@ -49,10 +49,8 @@ void recursive_file_tree(LIBMTP_mtpdevice_t *device, |
} |
/* Iterate over the filelisting */ |
- file = files; |
- while (file != NULL) { |
+ for (file = files; file != NULL; file = file->next) { |
int i; |
- LIBMTP_file_t *oldfile; |
/* Indent */ |
for (i = 0; i < depth; i++) { |
@@ -62,10 +60,6 @@ void recursive_file_tree(LIBMTP_mtpdevice_t *device, |
if (file->filetype == LIBMTP_FILETYPE_FOLDER) { |
recursive_file_tree(device, storage, file->item_id, depth+2); |
} |
- |
- oldfile = file; |
- file = file->next; |
- LIBMTP_destroy_file_t(oldfile); |
} |
} |