mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-18 17:04:34 +00:00
Squash some more potential null pointer dereferences
This commit is contained in:
parent
59546e6f34
commit
64272ef327
@ -360,10 +360,15 @@ returntype main_entry(signature())
|
||||
|
||||
rarch_main_clear_state();
|
||||
|
||||
if (!(ret = (main_load_content(argc, argv, args,
|
||||
driver.frontend_ctx->environment_get,
|
||||
driver.frontend_ctx->process_args))))
|
||||
return_var(ret);
|
||||
if (driver.frontend_ctx)
|
||||
{
|
||||
if (!(ret = (main_load_content(argc, argv, args,
|
||||
driver.frontend_ctx->environment_get,
|
||||
driver.frontend_ctx->process_args))))
|
||||
{
|
||||
return_var(ret);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_MENU)
|
||||
#if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE)
|
||||
|
12
gfx/gl.c
12
gfx/gl.c
@ -203,8 +203,16 @@ static bool gl_shader_init(gl_t *gl)
|
||||
const char *shader_path = (g_settings.video.shader_enable && *g_settings.video.shader_path) ?
|
||||
g_settings.video.shader_path : NULL;
|
||||
|
||||
enum rarch_shader_type type = gfx_shader_parse_type(shader_path,
|
||||
gl->core_context ? RARCH_SHADER_GLSL : DEFAULT_SHADER_TYPE);
|
||||
enum rarch_shader_type type;
|
||||
|
||||
if (!gl)
|
||||
{
|
||||
RARCH_ERR("Invalid GL instance passed to %s", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
type = gfx_shader_parse_type(shader_path,
|
||||
gl->core_context ? RARCH_SHADER_GLSL : DEFAULT_SHADER_TYPE);
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
@ -1289,6 +1289,9 @@ unsigned input_translate_str_to_bind_id(const char *str)
|
||||
|
||||
static void parse_hat(struct retro_keybind *bind, const char *str)
|
||||
{
|
||||
if (!bind || !str)
|
||||
return;
|
||||
|
||||
if (!isdigit(*str))
|
||||
return;
|
||||
|
||||
|
@ -16,8 +16,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include "message_queue.h"
|
||||
#include "boolean.h"
|
||||
#include "message_queue.h"
|
||||
#include "retroarch_logger.h"
|
||||
#include "compat/posix_string.h"
|
||||
|
||||
struct queue_elem
|
||||
@ -72,6 +73,11 @@ void msg_queue_push(msg_queue_t *queue, const char *msg,
|
||||
|
||||
struct queue_elem *new_elem = (struct queue_elem*)
|
||||
calloc(1, sizeof(struct queue_elem));
|
||||
if (!new_elem)
|
||||
{
|
||||
RARCH_ERR("New element allocation failed in %s", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
new_elem->prio = prio;
|
||||
new_elem->duration = duration;
|
||||
|
17
netplay.c
17
netplay.c
@ -752,17 +752,28 @@ static bool get_info_spectate(netplay_t *handle)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void init_buffers(netplay_t *handle)
|
||||
static bool init_buffers(netplay_t *handle)
|
||||
{
|
||||
unsigned i;
|
||||
handle->buffer = (struct delta_frame*)calloc(handle->buffer_size,
|
||||
sizeof(*handle->buffer));
|
||||
|
||||
if (!handle->buffer)
|
||||
return false;
|
||||
|
||||
handle->state_size = pretro_serialize_size();
|
||||
|
||||
for (i = 0; i < handle->buffer_size; i++)
|
||||
{
|
||||
handle->buffer[i].state = malloc(handle->state_size);
|
||||
|
||||
if (!handle->buffer[i].state)
|
||||
return false;
|
||||
|
||||
handle->buffer[i].is_simulated = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
netplay_t *netplay_new(const char *server, uint16_t port,
|
||||
@ -818,7 +829,9 @@ netplay_t *netplay_new(const char *server, uint16_t port,
|
||||
|
||||
handle->buffer_size = frames + 1;
|
||||
|
||||
init_buffers(handle);
|
||||
if (!init_buffers(handle))
|
||||
goto error;
|
||||
|
||||
handle->has_connection = true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user