summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Sami Kortelainen2021-08-04 08:11:17 +0300
committerGravatar Nikias Bassen2022-05-02 12:04:50 +0200
commit3c72864eca9e68897b07f1b4dd11b722bd4b82d4 (patch)
tree46838456fefe5129bf1f9290f4ffa73d3bfdc285
parent795af998e26894ede2245f6dd4d1ecd85478f4a2 (diff)
downloadlibimobiledevice-3c72864eca9e68897b07f1b4dd11b722bd4b82d4.tar.gz
libimobiledevice-3c72864eca9e68897b07f1b4dd11b722bd4b82d4.tar.bz2
lockdownd: Fix memory leaks in error conditions
-rw-r--r--src/lockdown.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lockdown.c b/src/lockdown.c
index d0922dd..505b13e 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -766,12 +766,15 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_client_new_with_handshake(idevi
uerr = userpref_read_pair_record(client_loc->device->udid, &pair_record);
if (uerr == USERPREF_E_READ_ERROR) {
debug_info("ERROR: Failed to retrieve pair record for %s", client_loc->device->udid);
+ lockdownd_client_free(client_loc);
return LOCKDOWN_E_RECEIVE_TIMEOUT;
} else if (uerr == USERPREF_E_NOENT) {
debug_info("ERROR: No pair record for %s", client_loc->device->udid);
+ lockdownd_client_free(client_loc);
return LOCKDOWN_E_INVALID_CONF;
} else if (uerr != USERPREF_E_SUCCESS) {
debug_info("ERROR: Failed to retrieve or parse pair record for %s", client_loc->device->udid);
+ lockdownd_client_free(client_loc);
return LOCKDOWN_E_INVALID_CONF;
}
if (pair_record) {