diff options
| author | 2014-08-19 12:45:16 -0400 | |
|---|---|---|
| committer | 2014-08-22 07:33:45 +0200 | |
| commit | 8e96f2af5960f4f5e4b52e4d7fe4e3c0ff2fe655 (patch) | |
| tree | 53d479a80c50373b69a1c2afebf68a70b4deba61 /src/afc.c | |
| parent | e02b675d265d9be3abccbd3b730bb7dffbf811e3 (diff) | |
| download | libimobiledevice-8e96f2af5960f4f5e4b52e4d7fe4e3c0ff2fe655.tar.gz libimobiledevice-8e96f2af5960f4f5e4b52e4d7fe4e3c0ff2fe655.tar.bz2 | |
afc_file_tell: fixed leak of unnecessary buffer and removed condition check before free.
Diffstat (limited to 'src/afc.c')
| -rw-r--r-- | src/afc.c | 5 |
1 files changed, 2 insertions, 3 deletions
| @@ -846,7 +846,7 @@ afc_error_t afc_file_seek(afc_client_t client, uint64_t handle, int64_t offset, | |||
| 846 | 846 | ||
| 847 | afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *position) | 847 | afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *position) |
| 848 | { | 848 | { |
| 849 | char *buffer = (char *) malloc(sizeof(char) * 8); | 849 | char *buffer = NULL; |
| 850 | uint32_t bytes = 0; | 850 | uint32_t bytes = 0; |
| 851 | afc_error_t ret = AFC_E_UNKNOWN_ERROR; | 851 | afc_error_t ret = AFC_E_UNKNOWN_ERROR; |
| 852 | 852 | ||
| @@ -870,8 +870,7 @@ afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *positi | |||
| 870 | memcpy(position, buffer, sizeof(uint64_t)); | 870 | memcpy(position, buffer, sizeof(uint64_t)); |
| 871 | *position = le64toh(*position); | 871 | *position = le64toh(*position); |
| 872 | } | 872 | } |
| 873 | if (buffer) | 873 | free(buffer); |
| 874 | free(buffer); | ||
| 875 | 874 | ||
| 876 | afc_unlock(client); | 875 | afc_unlock(client); |
| 877 | 876 | ||
