summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/userpref.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/userpref.c b/common/userpref.c
index d84cdac..664ba25 100644
--- a/common/userpref.c
+++ b/common/userpref.c
@@ -392,6 +392,9 @@ void userpref_get_system_buid(char **system_buid)
debug_info("got %s %s", USERPREF_SYSTEM_BUID_KEY, *system_buid);
}
+ if (value)
+ plist_free(value);
+
if (!*system_buid) {
/* no config, generate system_buid */
debug_info("no previous %s found", USERPREF_SYSTEM_BUID_KEY);
@@ -412,6 +415,9 @@ void userpref_device_record_get_host_id(const char *udid, char **host_id)
plist_get_string_val(value, host_id);
}
+ if (value)
+ plist_free(value);
+
if (!*host_id) {
/* no config, generate host_id */
*host_id = userpref_generate_host_id(0);
@@ -1051,9 +1057,11 @@ userpref_error_t userpref_device_record_get_certs_as_pem(const char *udid, key_d
char* buffer = NULL;
uint64_t length = 0;
+
plist_t root_cert = NULL;
plist_t host_cert = NULL;
plist_t dev_cert = NULL;
+
if (userpref_device_record_get_value(udid, USERPREF_HOST_CERTIFICATE_KEY, &host_cert) &&
userpref_device_record_get_value(udid, USERPREF_ROOT_CERTIFICATE_KEY, &root_cert)) {
if (host_cert && plist_get_node_type(host_cert) == PLIST_DATA) {
@@ -1097,6 +1105,13 @@ userpref_error_t userpref_device_record_get_certs_as_pem(const char *udid, key_d
}
}
+ if (root_cert)
+ plist_free(root_cert);
+ if (host_cert)
+ plist_free(host_cert);
+ if (dev_cert)
+ plist_free(dev_cert);
+
debug_info("configuration invalid");
return USERPREF_E_INVALID_CONF;