diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index da00ccef67..d77b386066 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -2788,6 +2788,9 @@ static void vulkan_overlay_free(vk_t *vk) vk->context->device, &vk->overlay.images[i]); + if (vk->overlay.images) + free(vk->overlay.images); + memset(&vk->overlay, 0, sizeof(vk->overlay)); } diff --git a/gfx/video_thread_wrapper.c b/gfx/video_thread_wrapper.c index 1a9e47dac0..ad1c2659f0 100644 --- a/gfx/video_thread_wrapper.c +++ b/gfx/video_thread_wrapper.c @@ -439,8 +439,6 @@ static bool video_thread_handle_packet( case CMD_OVERLAY_LOAD: { - float *tmp_alpha_mod = NULL; - if (thr->overlay && thr->overlay->load) ret = thr->overlay->load(thr->driver_data, pkt.data.image.data, @@ -448,11 +446,21 @@ static bool video_thread_handle_packet( pkt.data.b = ret; thr->alpha_mods = pkt.data.image.num; - tmp_alpha_mod = (float*)realloc(thr->alpha_mod, - thr->alpha_mods * sizeof(float)); - if (tmp_alpha_mod) - thr->alpha_mod = tmp_alpha_mod; + if (thr->alpha_mods > 0) + { + float *tmp_alpha_mod = (float*)realloc(thr->alpha_mod, + thr->alpha_mods * sizeof(float)); + + if (tmp_alpha_mod) + thr->alpha_mod = tmp_alpha_mod; + } + else + { + if (thr->alpha_mod) + free(thr->alpha_mod); + thr->alpha_mod = NULL; + } /* Avoid temporary garbage data. */ for (i = 0; i < thr->alpha_mods; i++) diff --git a/retroarch.c b/retroarch.c index f183993631..15b49261b5 100644 --- a/retroarch.c +++ b/retroarch.c @@ -24368,7 +24368,9 @@ static int16_t input_state_device( res = 1; /* Don't allow turbo for D-pad. */ - if ((id < RETRO_DEVICE_ID_JOYPAD_UP || id > RETRO_DEVICE_ID_JOYPAD_RIGHT)) + if ((id < RETRO_DEVICE_ID_JOYPAD_UP) || + ((id > RETRO_DEVICE_ID_JOYPAD_RIGHT) && + (id <= RETRO_DEVICE_ID_JOYPAD_R3))) { /* * Apply turbo button if activated.