summaryrefslogtreecommitdiffstats
path: root/src/recovery.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2013-09-24 19:35:27 +0200
committerGravatar Nikias Bassen2013-09-24 19:35:27 +0200
commit8b71e0945b6ab843b3528b03fdb22d6ff02b0c55 (patch)
treebd3f22ae9957f5e6f1a2732eeafaf566ea2d41fe /src/recovery.c
parent99d1bb1da4163c59ff6247ca02a4cea88090d92d (diff)
downloadidevicerestore-8b71e0945b6ab843b3528b03fdb22d6ff02b0c55.tar.gz
idevicerestore-8b71e0945b6ab843b3528b03fdb22d6ff02b0c55.tar.bz2
recovery: fix possible segfault and plug some small memory leaks
Diffstat (limited to 'src/recovery.c')
-rw-r--r--src/recovery.c24
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 */