summaryrefslogtreecommitdiffstats
path: root/src/lockdown.c
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2008-08-17 22:15:44 +0200
committerGravatar Jonathan Beck2008-08-21 19:13:35 +0200
commitef6206f51596d3c643dc0efe441ecaa0159f5632 (patch)
tree869cb749fcfdb1b06d5ee76f103ac72a72575e05 /src/lockdown.c
parentab38ab2ec7166f35aa0b8943d0b9f020c514e024 (diff)
downloadlibimobiledevice-ef6206f51596d3c643dc0efe441ecaa0159f5632.tar.gz
libimobiledevice-ef6206f51596d3c643dc0efe441ecaa0159f5632.tar.bz2
use NULL at end of dictionary values (fixes a memory leak).
Diffstat (limited to 'src/lockdown.c')
-rw-r--r--src/lockdown.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lockdown.c b/src/lockdown.c
index 76dbf7b..7f48dda 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -202,7 +202,7 @@ int lockdownd_hello(lockdownd_client *control) {
202 xmlFreeDoc(plist); 202 xmlFreeDoc(plist);
203 free(XML_content); 203 free(XML_content);
204 204
205 for (i = 0; strcmp(dictionary[i], ""); i+=2) { 205 for (i = 0; dictionary[i]; i+=2) {
206 if (!strcmp(dictionary[i], "Result") && !strcmp(dictionary[i+1], "Success")) { 206 if (!strcmp(dictionary[i], "Result") && !strcmp(dictionary[i+1], "Success")) {
207 free_dictionary(dictionary); 207 free_dictionary(dictionary);
208 if (debug) printf("lockdownd_hello(): success\n"); 208 if (debug) printf("lockdownd_hello(): success\n");
@@ -258,7 +258,7 @@ int lockdownd_get_device_public_key(lockdownd_client *control, char **public_key
258 free(XML_content); 258 free(XML_content);
259 259
260 int success = 0; 260 int success = 0;
261 for (i = 0; strcmp(dictionary[i], ""); i+=2) { 261 for (i = 0; dictionary[i]; i+=2) {
262 if (!strcmp(dictionary[i], "Result") && !strcmp(dictionary[i+1], "Success")) { 262 if (!strcmp(dictionary[i], "Result") && !strcmp(dictionary[i+1], "Success")) {
263 success = 1; 263 success = 1;
264 } 264 }
@@ -395,7 +395,7 @@ int lockdownd_pair_device(lockdownd_client *control, char *public_key_b64, char
395 free(XML_content); 395 free(XML_content);
396 396
397 int success = 0; 397 int success = 0;
398 for (i = 0; strcmp(dictionary[i], ""); i+=2) { 398 for (i = 0; dictionary[i]; i+=2) {
399 if (!strcmp(dictionary[i], "Result") && !strcmp(dictionary[i+1], "Success")) { 399 if (!strcmp(dictionary[i], "Result") && !strcmp(dictionary[i+1], "Success")) {
400 success = 1; 400 success = 1;
401 } 401 }
@@ -592,7 +592,7 @@ int lockdownd_start_SSL_session(lockdownd_client *control, const char *HostID) {
592 dictionary = read_dict_element_strings(dict); 592 dictionary = read_dict_element_strings(dict);
593 xmlFreeDoc(plist); 593 xmlFreeDoc(plist);
594 free(what2send); 594 free(what2send);
595 for (i = 0; strcmp(dictionary[i], ""); i+=2) { 595 for (i = 0; dictionary[i]; i+=2) {
596 if (!strcmp(dictionary[i], "Result") && !strcmp(dictionary[i+1], "Success")) { 596 if (!strcmp(dictionary[i], "Result") && !strcmp(dictionary[i+1], "Success")) {
597 // Set up GnuTLS... 597 // Set up GnuTLS...
598 //gnutls_anon_client_credentials_t anoncred; 598 //gnutls_anon_client_credentials_t anoncred;
@@ -650,7 +650,7 @@ int lockdownd_start_SSL_session(lockdownd_client *control, const char *HostID) {
650 if (debug) { 650 if (debug) {
651 printf("Apparently failed negotiating with lockdownd.\n"); 651 printf("Apparently failed negotiating with lockdownd.\n");
652 printf("Responding dictionary: \n"); 652 printf("Responding dictionary: \n");
653 for (i = 0; strcmp(dictionary[i], ""); i+=2) { 653 for (i = 0; dictionary[i]; i+=2) {
654 printf("\t%s: %s\n", dictionary[i], dictionary[i+1]); 654 printf("\t%s: %s\n", dictionary[i], dictionary[i+1]);
655 } 655 }
656 } 656 }
@@ -814,7 +814,7 @@ int lockdownd_start_service(lockdownd_client *control, const char *service) {
814 if (!dict) return 0; 814 if (!dict) return 0;
815 dictionary = read_dict_element_strings(dict); 815 dictionary = read_dict_element_strings(dict);
816 816
817 for (i = 0; strcmp(dictionary[i], ""); i+=2) { 817 for (i = 0; dictionary[i]; i+=2) {
818 if (debug) printf("lockdownd_start_service() dictionary %s: %s\n", dictionary[i], dictionary[i+1]); 818 if (debug) printf("lockdownd_start_service() dictionary %s: %s\n", dictionary[i], dictionary[i+1]);
819 819
820 if (!xmlStrcmp(dictionary[i], "Port")) { 820 if (!xmlStrcmp(dictionary[i], "Port")) {