mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 13:20:43 +00:00
Fix explicit NULL dereferenced/dereference before null check warnings
This commit is contained in:
parent
142dd82067
commit
a98616b45b
@ -83,7 +83,7 @@ static void core_info_list_resolve_all_firmware(
|
||||
core_info_t *info = (core_info_t*)&core_info_list->list[i];
|
||||
config_file_t *config = (config_file_t*)info->config_data;
|
||||
|
||||
if (!info || !config)
|
||||
if (!config)
|
||||
continue;
|
||||
|
||||
if (!config_get_uint(config, "firmware_count", &count))
|
||||
|
@ -833,9 +833,7 @@ static void check_proc_acpi_sysfs_ac_adapter(const char * node, bool *have_ac)
|
||||
if (strstr((char*)buf, "1"))
|
||||
*have_ac = true;
|
||||
|
||||
if (buf)
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
free(buf);
|
||||
}
|
||||
|
||||
static bool next_string(char **_ptr, char **_str)
|
||||
|
@ -348,7 +348,7 @@ static bool video_thread_handle_packet(
|
||||
* it's called in this "special" way. */
|
||||
thr->frame.within_thread = true;
|
||||
|
||||
if (thr->driver && thr->driver->read_viewport)
|
||||
if (thr->driver->read_viewport)
|
||||
ret = thr->driver->read_viewport(thr->driver_data,
|
||||
(uint8_t*)pkt.data.v);
|
||||
|
||||
|
@ -515,8 +515,7 @@ static void libusb_hid_free(void *data)
|
||||
libusb_hotplug_deregister_callback(hid->ctx, hid->hp);
|
||||
|
||||
libusb_exit(hid->ctx);
|
||||
if (hid)
|
||||
free(hid);
|
||||
free(hid);
|
||||
}
|
||||
|
||||
static void poll_thread(void *data)
|
||||
|
@ -59,11 +59,13 @@ ssem_t *ssem_new(int value)
|
||||
return semaphore;
|
||||
|
||||
error:
|
||||
if (semaphore->mutex)
|
||||
slock_free(semaphore->mutex);
|
||||
semaphore->mutex = NULL;
|
||||
if (semaphore)
|
||||
{
|
||||
if (semaphore->mutex)
|
||||
slock_free(semaphore->mutex);
|
||||
semaphore->mutex = NULL;
|
||||
free((void*)semaphore);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -200,14 +200,13 @@ static int deferred_push_cursor_manager_list_deferred_query_subsearch(
|
||||
goto end;
|
||||
|
||||
strlcpy(info->path, str_list->elems[1].data, sizeof(info->path));
|
||||
strlcpy(info->path_b, str_list->elems[0].data, sizeof(info->path_b));
|
||||
strlcpy(info->path_c, query, sizeof(info->path_c));
|
||||
strlcpy(info->path_b, str_list->elems[0].data, sizeof(info->path_b));
|
||||
strlcpy(info->path_c, query, sizeof(info->path_c));
|
||||
|
||||
ret = deferred_push_dlist(info, DISPLAYLIST_DATABASE_QUERY);
|
||||
|
||||
end:
|
||||
if (str_list)
|
||||
string_list_free(str_list);
|
||||
string_list_free(str_list);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
@ -403,9 +403,6 @@ static bool zarch_zui_tab(zui_t *zui, struct zui_tabbed *tab,
|
||||
const float *bg = zui_bg_panel;
|
||||
bool selected = tab->tab_selection == tab_id; /* TODO/FIXME */
|
||||
|
||||
if (!zui || !tab )
|
||||
return false;
|
||||
|
||||
if (!width)
|
||||
{
|
||||
if (!zui->fb_buf)
|
||||
@ -739,9 +736,6 @@ static int zarch_zui_render_lay_root(zui_t *zui)
|
||||
tabbed.width = zui->width - 290 - 40;
|
||||
zui->next_selection_set = false;
|
||||
|
||||
if (!zui)
|
||||
return 1;
|
||||
|
||||
if (zarch_zui_render_lay_root_recent(zui, &tabbed))
|
||||
return 0;
|
||||
if (zarch_zui_render_lay_root_load (zui, &tabbed))
|
||||
|
@ -50,8 +50,7 @@ static void menu_list_free_list(file_list_t *list)
|
||||
menu_driver_ctl(RARCH_MENU_CTL_LIST_FREE, &list_info);
|
||||
}
|
||||
|
||||
if (list)
|
||||
file_list_free(list);
|
||||
file_list_free(list);
|
||||
}
|
||||
|
||||
static void menu_list_free(menu_list_t *menu_list)
|
||||
|
@ -195,7 +195,8 @@ void menu_input_st_hex_cb(void *userdata, const char *str)
|
||||
unsigned *ptr = (unsigned*)setting_get_ptr(setting);
|
||||
if (str[0] == '#')
|
||||
str++;
|
||||
*ptr = strtoul(str, NULL, 16);
|
||||
if (ptr)
|
||||
*ptr = strtoul(str, NULL, 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -411,8 +411,7 @@ static int task_database_iterate_crc_lookup(
|
||||
if (db_state->list_index < db_state->list->size)
|
||||
return 1;
|
||||
|
||||
if (db_state->info)
|
||||
database_info_list_free(db_state->info);
|
||||
database_info_list_free(db_state->info);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -488,8 +487,7 @@ static int task_database_iterate_serial_lookup(
|
||||
if (db_state->list_index < db_state->list->size)
|
||||
return 1;
|
||||
|
||||
if (db_state->info)
|
||||
database_info_list_free(db_state->info);
|
||||
database_info_list_free(db_state->info);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ static int cb_image_menu_upload_generic(void *data, size_t len)
|
||||
nbio_handle_t *nbio = (nbio_handle_t*)data;
|
||||
nbio_image_handle_t *image = (nbio_image_handle_t*)nbio->data;
|
||||
|
||||
if (!nbio || !image)
|
||||
if (!image)
|
||||
return -1;
|
||||
|
||||
if (image->processing_final_state == IMAGE_PROCESS_ERROR ||
|
||||
@ -125,11 +125,11 @@ static int task_image_process(
|
||||
|
||||
static int cb_image_menu_generic(nbio_handle_t *nbio)
|
||||
{
|
||||
int retval;
|
||||
unsigned width = 0, height = 0;
|
||||
nbio_image_handle_t *image = (nbio_image_handle_t*)nbio->data;
|
||||
int retval;
|
||||
|
||||
if (!nbio || !image)
|
||||
if (!image)
|
||||
return -1;
|
||||
|
||||
retval = task_image_process(nbio, &width, &height);
|
||||
@ -157,11 +157,11 @@ static int cb_image_menu_thumbnail(void *data, size_t len)
|
||||
|
||||
static int task_image_iterate_process_transfer(nbio_handle_t *nbio)
|
||||
{
|
||||
unsigned i, width = 0, height = 0;
|
||||
int retval = 0;
|
||||
unsigned i, width = 0, height = 0;
|
||||
nbio_image_handle_t *image = (nbio_image_handle_t*)nbio->data;
|
||||
|
||||
if (!nbio || !image)
|
||||
if (!image)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < image->processing_pos_increment; i++)
|
||||
@ -184,7 +184,7 @@ static int task_image_iterate_transfer(nbio_handle_t *nbio)
|
||||
unsigned i;
|
||||
nbio_image_handle_t *image = (nbio_image_handle_t*)nbio->data;
|
||||
|
||||
if (!nbio || !image)
|
||||
if (!image)
|
||||
goto error;
|
||||
|
||||
if (image->is_finished)
|
||||
|
@ -101,7 +101,6 @@ static bool rarch_task_overlay_load_desc(
|
||||
char conf_key[64] = {0};
|
||||
char overlay_desc_normalized_key[64] = {0};
|
||||
char overlay[256] = {0};
|
||||
char *save = NULL;
|
||||
char *key = NULL;
|
||||
struct string_list *list = NULL;
|
||||
const char *x = NULL;
|
||||
@ -174,12 +173,11 @@ static bool rarch_task_overlay_load_desc(
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *tmp = NULL;
|
||||
char *save = NULL;
|
||||
const char *tmp = strtok_r(key, "|", &save);
|
||||
|
||||
desc->type = OVERLAY_TYPE_BUTTONS;
|
||||
|
||||
tmp = strtok_r(key, "|", &save);
|
||||
|
||||
for (; tmp; tmp = strtok_r(NULL, "|", &save))
|
||||
{
|
||||
if (!string_is_equal(tmp, "nul"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user