diff options
Diffstat (limited to 'common/userpref.c')
-rw-r--r-- | common/userpref.c | 9 |
1 files 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) |