summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Aaron Burghardt2013-06-30 20:52:51 -0400
committerGravatar Aaron Burghardt2013-06-30 21:28:58 -0400
commit8521693b1199e1e5274efed00c908afc8a128516 (patch)
treeab35fa23365c1bcb66744d6af6a4d3db5faa45dd
parent8184f352eadf3cdfdb66db66dfe4b890525063b7 (diff)
downloadlibimobiledevice-8521693b1199e1e5274efed00c908afc8a128516.tar.gz
libimobiledevice-8521693b1199e1e5274efed00c908afc8a128516.tar.bz2
Fixed multiple occurrences of memory leaks when empty plist dicts are passed to mobilebackup2_send_status_response().
-rw-r--r--tools/idevicebackup2.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index 45ff489..41591eb 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -1006,7 +1006,10 @@ static int mb2_handle_receive_files(mobilebackup2_client_t mobilebackup2, plist_
free(dname);
// TODO error handling?!
- mobilebackup2_send_status_response(mobilebackup2, 0, NULL, plist_new_dict());
+ plist_t empty_plist = plist_new_dict();
+ mobilebackup2_send_status_response(mobilebackup2, 0, NULL, empty_plist);
+ plist_free(empty_plist);
+
return file_count;
}
@@ -1997,7 +2000,9 @@ checkpoint:
errdesc = "Could not create dict iterator";
printf("Could not create dict iterator\n");
}
- err = mobilebackup2_send_status_response(mobilebackup2, errcode, errdesc, plist_new_dict());
+ plist_t empty_dict = plist_new_dict();
+ err = mobilebackup2_send_status_response(mobilebackup2, errcode, errdesc, empty_dict);
+ plist_free(empty_dict);
if (err != MOBILEBACKUP2_E_SUCCESS) {
printf("Could not send status response, error %d\n", err);
}
@@ -2049,7 +2054,9 @@ checkpoint:
}
}
}
- err = mobilebackup2_send_status_response(mobilebackup2, errcode, errdesc, plist_new_dict());
+ plist_t empty_dict = plist_new_dict();
+ err = mobilebackup2_send_status_response(mobilebackup2, errcode, errdesc, empty_dict);
+ plist_free(empty_dict);
if (err != MOBILEBACKUP2_E_SUCCESS) {
printf("Could not send status response, error %d\n", err);
}
@@ -2082,8 +2089,9 @@ checkpoint:
free(src);
free(dst);
}
-
- err = mobilebackup2_send_status_response(mobilebackup2, errcode, errdesc, plist_new_dict());
+ plist_t empty_dict = plist_new_dict();
+ err = mobilebackup2_send_status_response(mobilebackup2, errcode, errdesc, empty_dict);
+ plist_free(empty_dict);
if (err != MOBILEBACKUP2_E_SUCCESS) {
printf("Could not send status response, error %d\n", err);
}