From d9176411fc566299a50d365c74b2d077c3dbd293 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 6 Aug 2014 03:17:28 +0200 Subject: lockdown: Silence compiler warning about ignored return value from asprintf() --- src/lockdown.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/lockdown.c b/src/lockdown.c index 6465281..3e2fe06 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -1347,14 +1347,16 @@ lockdownd_error_t lockdownd_get_sync_data_classes(lockdownd_client_t client, cha } while((value = plist_array_get_item(dict, *count)) != NULL) { - plist_get_string_val(value, &val); - newlist = realloc(*classes, sizeof(char*) * (*count+1)); - str_remove_spaces(val); - asprintf(&newlist[*count], "com.apple.%s", val); - free(val); - val = NULL; - *classes = newlist; - *count = *count+1; + plist_get_string_val(value, &val); + newlist = realloc(*classes, sizeof(char*) * (*count+1)); + str_remove_spaces(val); + if (asprintf(&newlist[*count], "com.apple.%s", val) < 0) { + debug_info("ERROR: asprintf failed"); + } + free(val); + val = NULL; + *classes = newlist; + *count = *count+1; } newlist = realloc(*classes, sizeof(char*) * (*count+1)); -- cgit v1.1-32-gdbae