diff options
author | Nikias Bassen | 2013-09-24 19:35:27 +0200 |
---|---|---|
committer | Nikias Bassen | 2013-09-24 19:35:27 +0200 |
commit | 8b71e0945b6ab843b3528b03fdb22d6ff02b0c55 (patch) | |
tree | bd3f22ae9957f5e6f1a2732eeafaf566ea2d41fe | |
parent | 99d1bb1da4163c59ff6247ca02a4cea88090d92d (diff) | |
download | idevicerestore-8b71e0945b6ab843b3528b03fdb22d6ff02b0c55.tar.gz idevicerestore-8b71e0945b6ab843b3528b03fdb22d6ff02b0c55.tar.bz2 |
recovery: fix possible segfault and plug some small memory leaks
-rw-r--r-- | src/recovery.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/recovery.c b/src/recovery.c index 3edba5c..a1001dd 100644 --- a/src/recovery.c +++ b/src/recovery.c @@ -170,16 +170,32 @@ int recovery_enter_restore(struct idevicerestore_client_t* client, plist_t build info("Recovery Mode Environment:\n"); char* value = NULL; irecv_getenv(client->recovery->client, "build-version", &value); - info("iBoot build-version=%s\n", value); + info("iBoot build-version=%s\n", (value) ? value : "(unknown)"); + if (value) { + free(value); + value = NULL; + } irecv_getenv(client->recovery->client, "build-style", &value); - info("iBoot build-style=%s\n", value); + info("iBoot build-style=%s\n", (value) ? value : "(unknown)"); + if (value) { + free(value); + value = NULL; + } unsigned long radio_error = 0; irecv_getenv(client->recovery->client, "radio-error", &value); - radio_error = strtoul(value, NULL, 0); + if (value) { + radio_error = strtoul(value, NULL, 0); + } if (radio_error > 0) { info("radio-error=%s\n", value); + free(value); + value = NULL; irecv_getenv(client->recovery->client, "radio-error-string", &value); - info("radio-error-string=%s\n", value); + if (value) { + info("radio-error-string=%s\n", value); + free(value); + value = NULL; + } } /* send logo and show it */ |