settings_data: Guard against possible realloc/malloc failures