summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Aaron Burghardt2014-08-19 12:45:16 -0400
committerGravatar Nikias Bassen2014-08-22 07:33:45 +0200
commit8e96f2af5960f4f5e4b52e4d7fe4e3c0ff2fe655 (patch)
tree53d479a80c50373b69a1c2afebf68a70b4deba61
parente02b675d265d9be3abccbd3b730bb7dffbf811e3 (diff)
downloadlibimobiledevice-8e96f2af5960f4f5e4b52e4d7fe4e3c0ff2fe655.tar.gz
libimobiledevice-8e96f2af5960f4f5e4b52e4d7fe4e3c0ff2fe655.tar.bz2
afc_file_tell: fixed leak of unnecessary buffer and removed condition check before free.
-rw-r--r--src/afc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/afc.c b/src/afc.c
index b305859..7304d97 100644
--- a/src/afc.c
+++ b/src/afc.c
@@ -846,7 +846,7 @@ afc_error_t afc_file_seek(afc_client_t client, uint64_t handle, int64_t offset,
afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *position)
{
- char *buffer = (char *) malloc(sizeof(char) * 8);
+ char *buffer = NULL;
uint32_t bytes = 0;
afc_error_t ret = AFC_E_UNKNOWN_ERROR;
@@ -870,8 +870,7 @@ afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *positi
memcpy(position, buffer, sizeof(uint64_t));
*position = le64toh(*position);
}
- if (buffer)
- free(buffer);
+ free(buffer);
afc_unlock(client);