From 4c3f86499f8dfe344fb5f92b805e8c090290a79e Mon Sep 17 00:00:00 2001 From: Matt Colyer Date: Thu, 7 Aug 2008 00:00:12 -0700 Subject: 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.--- src/AFC.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/AFC.c') 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) { bytes = receive_AFC_data(client, &input); if (bytes < 0) { if (input) free(input); + afc_unlock(client); return -1; } else if (bytes == 0) { if (input) free(input); + afc_unlock(client); return current_count; } else { if (input) { @@ -493,6 +495,4 @@ void afc_close_file(AFClient *client, AFCFile *file) { bytes = receive_AFC_data(client, &buffer); afc_unlock(client); return; - if (buffer) free(buffer); // we're *SUPPOSED* to get an "error" here. } - -- cgit v1.1-32-gdbae