From 5245590bae46e455d997864b4e91d758e8fbb003 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 8 May 2017 05:55:20 +0200 Subject: [PATCH] (audio_mixer.c) Prevent null pointer dereference --- libretro-common/audio/audio_mixer.c | 3 ++- tasks/task_content.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libretro-common/audio/audio_mixer.c b/libretro-common/audio/audio_mixer.c index 796d725068..ee20e6384f 100644 --- a/libretro-common/audio/audio_mixer.c +++ b/libretro-common/audio/audio_mixer.c @@ -455,7 +455,8 @@ audio_mixer_voice_t* audio_mixer_play(audio_mixer_sound_t* sound, bool repeat, void audio_mixer_stop(audio_mixer_voice_t* voice) { - voice->stop_cb(voice, AUDIO_MIXER_SOUND_STOPPED); + if (voice && voice->stop_cb) + voice->stop_cb(voice, AUDIO_MIXER_SOUND_STOPPED); } static void mix_wav(float* buffer, size_t num_frames, audio_mixer_voice_t* voice) diff --git a/tasks/task_content.c b/tasks/task_content.c index 780dd7eac1..77caf2358b 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -1051,10 +1051,10 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info) /* Preliminary stuff that has to be done before we * load the actual content. Can differ per mode. */ - runloop_ctl(RUNLOOP_CTL_STATE_FREE, NULL); #ifdef HAVE_MENU menu_driver_ctl(RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT, NULL); #endif + runloop_ctl(RUNLOOP_CTL_STATE_FREE, NULL); runloop_ctl(RUNLOOP_CTL_DATA_DEINIT, NULL); runloop_ctl(RUNLOOP_CTL_TASK_INIT, NULL);