diff --git a/gfx/drivers/gl_core.c b/gfx/drivers/gl_core.c index 83c34e8fae..5efe7b3b22 100644 --- a/gfx/drivers/gl_core.c +++ b/gfx/drivers/gl_core.c @@ -503,7 +503,8 @@ static const gfx_ctx_driver_t *gl_core_get_context(gl_core_t *gl) #endif /* Force shared context. */ - gl->use_shared_context = hwr->context_type != RETRO_HW_CONTEXT_NONE; + if (hwr) + gl->use_shared_context = hwr->context_type != RETRO_HW_CONTEXT_NONE; gfx_ctx = video_context_driver_init_first(gl, settings->arrays.video_context_driver, diff --git a/libretro-common/net/net_http.c b/libretro-common/net/net_http.c index 4f2ad2635e..fef8400012 100644 --- a/libretro-common/net/net_http.c +++ b/libretro-common/net/net_http.c @@ -483,15 +483,18 @@ struct http_t *net_http_new(struct http_connection_t *conn) return state; error: - if (conn->methodcopy) - free(conn->methodcopy); - if (conn->contenttypecopy) - free(conn->contenttypecopy); - conn->methodcopy = NULL; - conn->contenttypecopy = NULL; - conn->postdatacopy = NULL; + if (conn) + { + if (conn->methodcopy) + free(conn->methodcopy); + if (conn->contenttypecopy) + free(conn->contenttypecopy); + conn->methodcopy = NULL; + conn->contenttypecopy = NULL; + conn->postdatacopy = NULL; + } #ifdef HAVE_SSL - if (conn->sock_state.ssl && conn->sock_state.ssl_ctx && fd >= 0) + if (conn && conn->sock_state.ssl && conn->sock_state.ssl_ctx && fd >= 0) { ssl_socket_close(conn->sock_state.ssl_ctx); ssl_socket_free(conn->sock_state.ssl_ctx); diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 7b444cbb29..76434fcce2 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -418,8 +418,9 @@ static int general_push(menu_displaylist_info_t *info, } else { - strlcpy(newstring2, system->valid_extensions, - PATH_MAX_LENGTH * sizeof(char)); + if (system) + strlcpy(newstring2, system->valid_extensions, + PATH_MAX_LENGTH * sizeof(char)); } } break; @@ -442,7 +443,7 @@ static int general_push(menu_displaylist_info_t *info, } else { - if (!string_is_empty(system->valid_extensions)) + if (system && !string_is_empty(system->valid_extensions)) { new_exts = strdup(system->valid_extensions); new_exts_allocated = true; @@ -473,7 +474,12 @@ static int general_push(menu_displaylist_info_t *info, } if (new_exts_allocated) + { free(new_exts); + + if (new_exts == info->exts) + info->exts = NULL; + } } break; case PUSH_ARCHIVE_OPEN_DETECT_CORE: diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 90fa4e0214..a9e2cb6436 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -3611,7 +3611,7 @@ finish: (transf ? transf->path: "unknown"), err); } #ifdef HAVE_DISCORD - else if (transf->enum_idx == MENU_ENUM_LABEL_CB_DISCORD_AVATAR) + else if (transf && transf->enum_idx == MENU_ENUM_LABEL_CB_DISCORD_AVATAR) discord_avatar_set_ready(true); #endif diff --git a/menu/drivers/ozone/ozone.c b/menu/drivers/ozone/ozone.c index 1f1edebf65..906d1d76ad 100644 --- a/menu/drivers/ozone/ozone.c +++ b/menu/drivers/ozone/ozone.c @@ -301,19 +301,23 @@ static void *ozone_init(void **userdata, bool video_is_threaded) return menu; error: - if (ozone->horizontal_list) + if (ozone) { - ozone_free_list_nodes(ozone->horizontal_list, false); - file_list_free(ozone->horizontal_list); - } + if (ozone->horizontal_list) + { + ozone_free_list_nodes(ozone->horizontal_list, false); + file_list_free(ozone->horizontal_list); + } - if (ozone->selection_buf_old) - { - ozone_free_list_nodes(ozone->selection_buf_old, false); - file_list_free(ozone->selection_buf_old); + if (ozone->selection_buf_old) + { + ozone_free_list_nodes(ozone->selection_buf_old, false); + file_list_free(ozone->selection_buf_old); + } + + ozone->selection_buf_old = NULL; + ozone->horizontal_list = NULL; } - ozone->selection_buf_old = NULL; - ozone->horizontal_list = NULL; if (menu) free(menu); diff --git a/menu/drivers/ozone/ozone_entries.c b/menu/drivers/ozone/ozone_entries.c index b81b56aed0..d908ffa48b 100644 --- a/menu/drivers/ozone/ozone_entries.c +++ b/menu/drivers/ozone/ozone_entries.c @@ -441,7 +441,8 @@ void ozone_draw_entries(ozone_handle_t *ozone, video_frame_info_t *video_info, } border_iterate: - y += node->height; + if (node) + y += node->height; } /* Cursor(s) layer - current */ diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 49c2edc18d..792e54ee3f 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2886,7 +2886,7 @@ static int menu_displaylist_parse_horizontal_content_actions( { const char *ext = NULL; - if (!string_is_empty(entry->path)) + if (entry && !string_is_empty(entry->path)) ext = path_get_extension(entry->path); if (!string_is_empty(ext) && @@ -2943,7 +2943,7 @@ static int menu_displaylist_parse_horizontal_content_actions( } } - if (!string_is_empty(entry->db_name) && (!content_loaded || + if ((entry && !string_is_empty(entry->db_name)) && (!content_loaded || (content_loaded && settings->bools.quick_menu_show_information))) { char *db_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); @@ -7782,7 +7782,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist PARSE_ACTION, false); /* Core fully loaded, use the subsystem data */ - if (sys_info->subsystem.data) + if (sys_info && sys_info->subsystem.data) subsystem = sys_info->subsystem.data; /* Core not loaded completely, use the data we peeked on load core */ else