mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 05:43:34 +00:00
Prevent explicit NULL dereferenced warnings
This commit is contained in:
parent
bc3eb34da5
commit
5eb43846da
15
dynamic.c
15
dynamic.c
@ -1363,15 +1363,18 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||||||
case RETRO_ENVIRONMENT_SET_MEMORY_MAPS:
|
case RETRO_ENVIRONMENT_SET_MEMORY_MAPS:
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
struct retro_memory_descriptor *descriptors;
|
struct retro_memory_descriptor *descriptors = NULL;
|
||||||
const struct retro_memory_map *mmaps =
|
const struct retro_memory_map *mmaps =
|
||||||
(const struct retro_memory_map*)data;
|
(const struct retro_memory_map*)data;
|
||||||
|
|
||||||
|
if (system)
|
||||||
|
{
|
||||||
|
RARCH_LOG("Environ SET_MEMORY_MAPS.\n");
|
||||||
free((void*)system->mmaps.descriptors);
|
free((void*)system->mmaps.descriptors);
|
||||||
system->mmaps.num_descriptors = 0;
|
system->mmaps.num_descriptors = 0;
|
||||||
|
|
||||||
descriptors = (struct retro_memory_descriptor*)
|
descriptors = (struct retro_memory_descriptor*)
|
||||||
calloc(mmaps->num_descriptors, sizeof(*system->mmaps.descriptors));
|
calloc(mmaps->num_descriptors,
|
||||||
|
sizeof(*system->mmaps.descriptors));
|
||||||
|
|
||||||
if (!descriptors)
|
if (!descriptors)
|
||||||
return false;
|
return false;
|
||||||
@ -1381,8 +1384,12 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||||||
mmaps->num_descriptors * sizeof(*system->mmaps.descriptors));
|
mmaps->num_descriptors * sizeof(*system->mmaps.descriptors));
|
||||||
system->mmaps.num_descriptors = mmaps->num_descriptors;
|
system->mmaps.num_descriptors = mmaps->num_descriptors;
|
||||||
mmap_preprocess_descriptors(descriptors, mmaps->num_descriptors);
|
mmap_preprocess_descriptors(descriptors, mmaps->num_descriptors);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RARCH_WARN("Environ SET_MEMORY_MAPS, but system pointer not initialized..\n");
|
||||||
|
}
|
||||||
|
|
||||||
RARCH_LOG("Environ SET_MEMORY_MAPS.\n");
|
|
||||||
|
|
||||||
if (sizeof(void *) == 8)
|
if (sizeof(void *) == 8)
|
||||||
RARCH_LOG(" ndx flags ptr offset start select disconn len addrspace\n");
|
RARCH_LOG(" ndx flags ptr offset start select disconn len addrspace\n");
|
||||||
|
@ -133,7 +133,7 @@ static void gfx_ctx_x_destroy_resources(gfx_ctx_x_data_t *x)
|
|||||||
|
|
||||||
x11_colormap_destroy();
|
x11_colormap_destroy();
|
||||||
|
|
||||||
if (x->g_should_reset_mode)
|
if (x->g_should_reset_mode && g_x11_dpy)
|
||||||
{
|
{
|
||||||
x11_exit_fullscreen(g_x11_dpy, &x->g_desktop_mode);
|
x11_exit_fullscreen(g_x11_dpy, &x->g_desktop_mode);
|
||||||
x->g_should_reset_mode = false;
|
x->g_should_reset_mode = false;
|
||||||
|
@ -451,7 +451,7 @@ static int file_archive_decompress_data_to_file(
|
|||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (handle->data)
|
if (handle && handle->data)
|
||||||
free(handle->data);
|
free(handle->data);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user