summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-10-08 23:59:30 +0200
committerGravatar Martin Szulecki2013-10-08 23:59:30 +0200
commitf5425a9e9acdf9d6b59461a083e9da8c52be6df1 (patch)
tree1a45df22afb04929a1457536a094b476cd40c154 /common
parent744e014d5240b8621b8b8a2aec954641e18d3ac7 (diff)
downloadlibimobiledevice-f5425a9e9acdf9d6b59461a083e9da8c52be6df1.tar.gz
libimobiledevice-f5425a9e9acdf9d6b59461a083e9da8c52be6df1.tar.bz2
userpref: Free some plist return values to fix a few memory leaks
Diffstat (limited to 'common')
-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;