diff options
author | Martin Szulecki | 2013-11-17 02:40:48 +0100 |
---|---|---|
committer | Martin Szulecki | 2013-11-30 20:13:59 +0100 |
commit | 868e336f8337e14e0288ac1d3c9fd89bee6d1961 (patch) | |
tree | d4ca282bc122791f61709afbd2445870426c4045 | |
parent | 5d429dddc5ed442ae4699ab34c21b35bacef456b (diff) | |
download | libimobiledevice-868e336f8337e14e0288ac1d3c9fd89bee6d1961.tar.gz libimobiledevice-868e336f8337e14e0288ac1d3c9fd89bee6d1961.tar.bz2 |
Fix possible memory corruption by ensuring client pointers NULL'd after free
-rw-r--r-- | src/idevice.c | 2 | ||||
-rw-r--r-- | src/lockdown.c | 1 | ||||
-rw-r--r-- | src/property_list_service.c | 3 | ||||
-rw-r--r-- | src/service.c | 3 |
4 files changed, 9 insertions, 0 deletions
diff --git a/src/idevice.c b/src/idevice.c index 3ed2e9f..428f359 100644 --- a/src/idevice.c +++ b/src/idevice.c @@ -267,6 +267,7 @@ idevice_error_t idevice_disconnect(idevice_connection_t connection) idevice_error_t result = IDEVICE_E_UNKNOWN_ERROR; if (connection->type == CONNECTION_USBMUXD) { usbmuxd_disconnect((int)(long)connection->data); + connection->data = NULL; result = IDEVICE_E_SUCCESS; } else { debug_info("Unknown connection type %d", connection->type); @@ -276,6 +277,7 @@ idevice_error_t idevice_disconnect(idevice_connection_t connection) free(connection->udid); free(connection); + connection = NULL; return result; } diff --git a/src/lockdown.c b/src/lockdown.c index c2e3654..60fbf0c 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -241,6 +241,7 @@ static lockdownd_error_t lockdownd_client_free_simple(lockdownd_client_t client) } free(client); + client = NULL; return ret; } diff --git a/src/property_list_service.c b/src/property_list_service.c index b8d4b93..3f2e6c3 100644 --- a/src/property_list_service.c +++ b/src/property_list_service.c @@ -101,7 +101,10 @@ property_list_service_error_t property_list_service_client_free(property_list_se return PROPERTY_LIST_SERVICE_E_INVALID_ARG; property_list_service_error_t err = service_to_property_list_service_error(service_client_free(client->parent)); + free(client); + client = NULL; + return err; } diff --git a/src/service.c b/src/service.c index 5bc7aea..e8444b8 100644 --- a/src/service.c +++ b/src/service.c @@ -157,7 +157,10 @@ service_error_t service_client_free(service_client_t client) return SERVICE_E_INVALID_ARG; service_error_t err = idevice_to_service_error(idevice_disconnect(client->connection)); + free(client); + client = NULL; + return err; } |