From 80d3d2cfa9ae1c6cc8b0e004373e8bc8c368dd56 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Fri, 21 Mar 2014 02:06:51 +0100 Subject: userpref: Fix invalid plist_free() which caused pair process to fail --- common/userpref.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/userpref.c b/common/userpref.c index 65f1988..3399036 100644 --- a/common/userpref.c +++ b/common/userpref.c @@ -1006,6 +1006,7 @@ userpref_error_t pair_record_get_item_as_key_data(plist_t pair_record, const cha if (!pair_record || !value) return USERPREF_E_INVALID_ARG; + userpref_error_t ret = USERPREF_E_SUCCESS; char* buffer = NULL; uint64_t length = 0; @@ -1018,12 +1019,14 @@ userpref_error_t pair_record_get_item_as_key_data(plist_t pair_record, const cha value->size = length; free(buffer); buffer = NULL; + } else { + ret = USERPREF_E_INVALID_CONF; } - if (node) - plist_free(node); + if (buffer) + free(buffer); - return USERPREF_E_SUCCESS; + return ret; } userpref_error_t pair_record_set_item_from_key_data(plist_t pair_record, const char* name, key_data_t *value) -- cgit v1.1-32-gdbae