diff options
author | Jonathan Beck | 2008-08-17 22:15:44 +0200 |
---|---|---|
committer | Jonathan Beck | 2008-08-21 19:13:35 +0200 |
commit | ef6206f51596d3c643dc0efe441ecaa0159f5632 (patch) | |
tree | 869cb749fcfdb1b06d5ee76f103ac72a72575e05 /src/lockdown.c | |
parent | ab38ab2ec7166f35aa0b8943d0b9f020c514e024 (diff) | |
download | libplist-ef6206f51596d3c643dc0efe441ecaa0159f5632.tar.gz libplist-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.c | 12 |
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) { xmlFreeDoc(plist); free(XML_content); - for (i = 0; strcmp(dictionary[i], ""); i+=2) { + for (i = 0; dictionary[i]; i+=2) { if (!strcmp(dictionary[i], "Result") && !strcmp(dictionary[i+1], "Success")) { free_dictionary(dictionary); if (debug) printf("lockdownd_hello(): success\n"); @@ -258,7 +258,7 @@ int lockdownd_get_device_public_key(lockdownd_client *control, char **public_key free(XML_content); int success = 0; - for (i = 0; strcmp(dictionary[i], ""); i+=2) { + for (i = 0; dictionary[i]; i+=2) { if (!strcmp(dictionary[i], "Result") && !strcmp(dictionary[i+1], "Success")) { success = 1; } @@ -395,7 +395,7 @@ int lockdownd_pair_device(lockdownd_client *control, char *public_key_b64, char free(XML_content); int success = 0; - for (i = 0; strcmp(dictionary[i], ""); i+=2) { + for (i = 0; dictionary[i]; i+=2) { if (!strcmp(dictionary[i], "Result") && !strcmp(dictionary[i+1], "Success")) { success = 1; } @@ -592,7 +592,7 @@ int lockdownd_start_SSL_session(lockdownd_client *control, const char *HostID) { dictionary = read_dict_element_strings(dict); xmlFreeDoc(plist); free(what2send); - for (i = 0; strcmp(dictionary[i], ""); i+=2) { + for (i = 0; dictionary[i]; i+=2) { if (!strcmp(dictionary[i], "Result") && !strcmp(dictionary[i+1], "Success")) { // Set up GnuTLS... //gnutls_anon_client_credentials_t anoncred; @@ -650,7 +650,7 @@ int lockdownd_start_SSL_session(lockdownd_client *control, const char *HostID) { if (debug) { printf("Apparently failed negotiating with lockdownd.\n"); printf("Responding dictionary: \n"); - for (i = 0; strcmp(dictionary[i], ""); i+=2) { + for (i = 0; dictionary[i]; i+=2) { printf("\t%s: %s\n", dictionary[i], dictionary[i+1]); } } @@ -814,7 +814,7 @@ int lockdownd_start_service(lockdownd_client *control, const char *service) { if (!dict) return 0; dictionary = read_dict_element_strings(dict); - for (i = 0; strcmp(dictionary[i], ""); i+=2) { + for (i = 0; dictionary[i]; i+=2) { if (debug) printf("lockdownd_start_service() dictionary %s: %s\n", dictionary[i], dictionary[i+1]); if (!xmlStrcmp(dictionary[i], "Port")) { |