summaryrefslogtreecommitdiffstats
path: root/src/recovery.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2015-09-24 20:22:15 +0200
committerGravatar Nikias Bassen2015-09-24 20:22:15 +0200
commiteb879c72e53585d55abbbf811d799b7ef43d1c02 (patch)
tree7e4b58d71bdcf2b654bf58305a4349aa229a7147 /src/recovery.c
parente658bf5278c22df809a8665242a304fea5234a30 (diff)
downloadidevicerestore-eb879c72e53585d55abbbf811d799b7ef43d1c02.tar.gz
idevicerestore-eb879c72e53585d55abbbf811d799b7ef43d1c02.tar.bz2
Revise several changes from commit 245bc9b6510a8900c69c2fd543434bae1bc6ca6a
In very rare cases the changes introduced by commit can actually cause an invalid free. Reverted those changes. Also, plist_free() will check for NULL before doing anything, so an extra check for that is not needed.
Diffstat (limited to 'src/recovery.c')
-rw-r--r--src/recovery.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/recovery.c b/src/recovery.c
index c21af19..907b1f2 100644
--- a/src/recovery.c
+++ b/src/recovery.c
@@ -168,13 +168,17 @@ int recovery_enter_restore(struct idevicerestore_client_t* client, plist_t build
char* value = NULL;
irecv_getenv(client->recovery->client, "build-version", &value);
info("iBoot build-version=%s\n", (value) ? value : "(unknown)");
- free(value);
- value = NULL;
+ if (value) {
+ free(value);
+ value = NULL;
+ }
irecv_getenv(client->recovery->client, "build-style", &value);
info("iBoot build-style=%s\n", (value) ? value : "(unknown)");
- free(value);
- value = NULL;
+ if (value) {
+ free(value);
+ value = NULL;
+ }
unsigned long radio_error = 0;
irecv_getenv(client->recovery->client, "radio-error", &value);
@@ -269,7 +273,6 @@ int recovery_send_component(struct idevicerestore_client_t* client, plist_t buil
if (!path) {
if (build_identity_get_component_path(build_identity, component, &path) < 0) {
error("ERROR: Unable to get path for component '%s'\n", component);
- free(path);
return -1;
}
}