summaryrefslogtreecommitdiffstats
path: root/src/AFC.c
diff options
context:
space:
mode:
authorGravatar Matt Colyer2008-08-07 00:00:12 -0700
committerGravatar Matt Colyer2008-08-07 00:00:12 -0700
commit4c3f86499f8dfe344fb5f92b805e8c090290a79e (patch)
treebba8b935df1b5ef637065e789a66f7b9fd2888f4 /src/AFC.c
parent1c6aa3dd8aa8cd985a63ccbfa3848ebbe52715e1 (diff)
downloadlibimobiledevice-4c3f86499f8dfe344fb5f92b805e8c090290a79e.tar.gz
libimobiledevice-4c3f86499f8dfe344fb5f92b805e8c090290a79e.tar.bz2
Added cleanup when closing a file, probably needs a bit more throughness
but its a start. Added a missing unlock call so you can read a file more than once.
Diffstat (limited to 'src/AFC.c')
-rw-r--r--src/AFC.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/AFC.c b/src/AFC.c
index 680a08f..6fb5a9e 100644
--- a/src/AFC.c
+++ b/src/AFC.c
@@ -423,9 +423,11 @@ int afc_read_file(AFClient *client, AFCFile *file, char *data, int length) {
423 bytes = receive_AFC_data(client, &input); 423 bytes = receive_AFC_data(client, &input);
424 if (bytes < 0) { 424 if (bytes < 0) {
425 if (input) free(input); 425 if (input) free(input);
426 afc_unlock(client);
426 return -1; 427 return -1;
427 } else if (bytes == 0) { 428 } else if (bytes == 0) {
428 if (input) free(input); 429 if (input) free(input);
430 afc_unlock(client);
429 return current_count; 431 return current_count;
430 } else { 432 } else {
431 if (input) { 433 if (input) {
@@ -493,6 +495,4 @@ void afc_close_file(AFClient *client, AFCFile *file) {
493 bytes = receive_AFC_data(client, &buffer); 495 bytes = receive_AFC_data(client, &buffer);
494 afc_unlock(client); 496 afc_unlock(client);
495 return; 497 return;
496 if (buffer) free(buffer); // we're *SUPPOSED* to get an "error" here.
497} 498}
498