Fix explicit NULL dereferenced warnings

This commit is contained in:
twinaphex 2016-06-01 04:05:14 +02:00
parent 9bb8c41ff6
commit da6ac4aae7
7 changed files with 30 additions and 20 deletions

View File

@ -367,7 +367,8 @@ end:
free(avg_filtered);
free(paeth_filtered);
stream_backend->stream_free(stream);
if (stream_backend)
stream_backend->stream_free(stream);
return ret;
}

View File

@ -410,7 +410,10 @@ static int general_push(menu_displaylist_info_t *info,
sizeof(info->exts));
}
else
strlcpy(info->exts, system->valid_extensions, sizeof(info->exts));
{
if (system->valid_extensions)
strlcpy(info->exts, system->valid_extensions, sizeof(info->exts));
}
break;
case PUSH_DETECT_CORE_LIST:
if (!string_is_empty(list->all_ext))

View File

@ -155,8 +155,9 @@ int generic_action_ok_displaylist_push(const char *path,
menu_path = menu->scratch2_buf;
content_path = menu->scratch_buf;
}
fill_pathname_join(detect_content_path, menu_path, content_path,
sizeof(detect_content_path));
if (content_path)
fill_pathname_join(detect_content_path, menu_path, content_path,
sizeof(detect_content_path));
switch (action_type)
{

View File

@ -453,12 +453,12 @@ int menu_entries_get_core_title(char *s, size_t len)
if (!settings->menu.core_enable)
return -1;
if (string_is_empty(core_name))
if (string_is_empty(core_name) && info)
core_name = info->info.library_name;
if (string_is_empty(core_name))
core_name = menu_hash_to_str(MENU_VALUE_NO_CORE);
if (!core_version)
if (!core_version && info)
core_version = info->info.library_version;
if (!core_version)
core_version = "";

View File

@ -2499,8 +2499,6 @@ static int setting_action_left_libretro_device_type(
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (!setting)
return -1;
@ -2509,13 +2507,18 @@ static int setting_action_left_libretro_device_type(
devices[types++] = RETRO_DEVICE_NONE;
devices[types++] = RETRO_DEVICE_JOYPAD;
/* Only push RETRO_DEVICE_ANALOG as default if we use an
* older core which doesn't use SET_CONTROLLER_INFO. */
if (!system->ports.size)
devices[types++] = RETRO_DEVICE_ANALOG;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (port < system->ports.size)
desc = &system->ports.data[port];
if (system)
{
/* Only push RETRO_DEVICE_ANALOG as default if we use an
* older core which doesn't use SET_CONTROLLER_INFO. */
if (!system->ports.size)
devices[types++] = RETRO_DEVICE_ANALOG;
if (port < system->ports.size)
desc = &system->ports.data[port];
}
if (desc)
{
@ -3068,9 +3071,10 @@ void general_write_handler(void *data)
video_driver_set_filtering(1, settings->video.smooth);
break;
case MENU_LABEL_VIDEO_ROTATION:
video_driver_set_rotation(
(*setting->value.target.unsigned_integer +
system->rotation) % 4);
if (system)
video_driver_set_rotation(
(*setting->value.target.unsigned_integer +
system->rotation) % 4);
break;
case MENU_LABEL_AUDIO_VOLUME:
audio_driver_set_volume_gain(db_to_gain(*setting->value.target.fraction));

View File

@ -1411,7 +1411,7 @@ static bool content_file_init(struct string_list *temporary_content)
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
if (*global->subsystem)
if (*global->subsystem && system)
{
special = init_content_file_subsystem(&ret, system);
if (!ret)
@ -1559,7 +1559,7 @@ static void menu_content_environment_get(int *argc, char *argv[],
wrap_args->sram_path = global->dir.savefile;
if (*global->dir.savestate)
wrap_args->state_path = global->dir.savestate;
if (*fullpath)
if (fullpath && *fullpath)
wrap_args->content_path = fullpath;
if (!global->has_set.libretro)
wrap_args->libretro_path = *settings->path.libretro

View File

@ -310,7 +310,8 @@ static int database_info_list_iterate_found_match(
snprintf(db_crc, sizeof(db_crc), "%08X|crc", db_info_entry->crc32);
strlcpy(entry_path_str, entry_path, sizeof(entry_path_str));
if (entry_path)
strlcpy(entry_path_str, entry_path, sizeof(entry_path_str));
if (!string_is_empty(zip_name))
fill_pathname_join_delim(entry_path_str, entry_path_str, zip_name,