mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
(Coverity) Fix uninitialized variables; fix some resource leaks
This commit is contained in:
parent
c72222b572
commit
0a3224180b
6 changed files with 27 additions and 23 deletions
|
@ -1961,8 +1961,8 @@ bool config_load_override(void)
|
|||
{
|
||||
char buf[PATH_MAX_LENGTH];
|
||||
char config_directory[PATH_MAX_LENGTH];
|
||||
char core_path[PATH_MAX_LENGTH];
|
||||
char game_path[PATH_MAX_LENGTH];
|
||||
char core_path[PATH_MAX_LENGTH] = {0};
|
||||
char game_path[PATH_MAX_LENGTH] = {0};
|
||||
config_file_t *new_conf = NULL;
|
||||
const char *core_name = NULL;
|
||||
const char *game_name = NULL;
|
||||
|
@ -2140,8 +2140,8 @@ bool config_load_override(void)
|
|||
bool config_load_remap(void)
|
||||
{
|
||||
char remap_directory[PATH_MAX_LENGTH]; /* path to the directory containing retroarch.cfg (prefix) */
|
||||
char core_path[PATH_MAX_LENGTH]; /* final path for core-specific configuration (prefix+suffix) */
|
||||
char game_path[PATH_MAX_LENGTH]; /* final path for game-specific configuration (prefix+suffix) */
|
||||
char core_path[PATH_MAX_LENGTH] = {0}; /* final path for core-specific configuration (prefix+suffix) */
|
||||
char game_path[PATH_MAX_LENGTH] = {0}; /* final path for game-specific configuration (prefix+suffix) */
|
||||
config_file_t *new_conf = NULL;
|
||||
const char *core_name = NULL;
|
||||
const char *game_name = NULL;
|
||||
|
|
|
@ -202,7 +202,7 @@ static bool input_autoconfigure_joypad_from_conf_dir(
|
|||
autoconfig_params_t *params)
|
||||
{
|
||||
size_t i;
|
||||
char path[PATH_MAX_LENGTH];
|
||||
char path[PATH_MAX_LENGTH] = {0};
|
||||
int ret = 0;
|
||||
int index = -1;
|
||||
int current_best = 0;
|
||||
|
|
|
@ -110,8 +110,8 @@ static void print_buf_lines(file_list_t *list, char *buf, int buf_size,
|
|||
|
||||
if (settings)
|
||||
{
|
||||
char core_path[PATH_MAX_LENGTH];
|
||||
char display_name[PATH_MAX_LENGTH];
|
||||
char core_path[PATH_MAX_LENGTH] = {0};
|
||||
char *last = NULL;
|
||||
|
||||
fill_pathname_join(
|
||||
|
@ -213,7 +213,7 @@ static void print_buf_lines_extended(file_list_t *list, char *buf, int buf_size,
|
|||
|
||||
if (settings)
|
||||
{
|
||||
char core_path[PATH_MAX_LENGTH];
|
||||
char core_path[PATH_MAX_LENGTH] = {0};
|
||||
char display_name[PATH_MAX_LENGTH];
|
||||
char *last = NULL;
|
||||
|
||||
|
@ -1590,7 +1590,7 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
|
|||
char path_playlist[PATH_MAX_LENGTH];
|
||||
char path_base[PATH_MAX_LENGTH] = {0};
|
||||
char query[PATH_MAX_LENGTH] = {0};
|
||||
playlist_t *playlist = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
database_info_list_t *db_info = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
@ -2164,7 +2164,8 @@ static int menu_displaylist_parse_horizontal_list(
|
|||
{
|
||||
menu_ctx_list_t list_info;
|
||||
menu_ctx_list_t list_horiz_info;
|
||||
char path_playlist[PATH_MAX_LENGTH], lpl_basename[PATH_MAX_LENGTH];
|
||||
char lpl_basename[PATH_MAX_LENGTH];
|
||||
char path_playlist[PATH_MAX_LENGTH] = {0};
|
||||
bool is_historylist = false;
|
||||
playlist_t *playlist = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
|
@ -3812,8 +3813,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
|||
}
|
||||
else
|
||||
{
|
||||
char path_playlist[PATH_MAX_LENGTH];
|
||||
playlist_t *playlist = NULL;
|
||||
char path_playlist[PATH_MAX_LENGTH] = {0};
|
||||
playlist_t *playlist = NULL;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_FREE, NULL);
|
||||
|
||||
|
@ -3935,10 +3936,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
|||
string_list_new_special(STRING_LIST_SUPPORTED_CORES_NAMES,
|
||||
(void*)menu->deferred_path,
|
||||
&cores_names_len, &cores_names_size);
|
||||
struct string_list *cores_paths =
|
||||
string_list_new_special(STRING_LIST_SUPPORTED_CORES_PATHS,
|
||||
(void*)menu->deferred_path,
|
||||
&cores_paths_len, &cores_paths_size);
|
||||
|
||||
if (cores_names_size == 0)
|
||||
{
|
||||
|
@ -3949,6 +3946,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
|||
}
|
||||
else
|
||||
{
|
||||
struct string_list *cores_paths =
|
||||
string_list_new_special(STRING_LIST_SUPPORTED_CORES_PATHS,
|
||||
(void*)menu->deferred_path,
|
||||
&cores_paths_len, &cores_paths_size);
|
||||
|
||||
for (i = 0; i < cores_names_size; i++)
|
||||
{
|
||||
switch (type)
|
||||
|
@ -3968,9 +3970,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
|||
cores_names->elems[i].data);
|
||||
}
|
||||
|
||||
string_list_free(cores_names);
|
||||
string_list_free(cores_paths);
|
||||
}
|
||||
|
||||
string_list_free(cores_names);
|
||||
}
|
||||
break;
|
||||
case DISPLAYLIST_CORE_INFO:
|
||||
|
|
|
@ -113,8 +113,9 @@ void menu_shader_manager_init(menu_handle_t *menu)
|
|||
break;
|
||||
default:
|
||||
{
|
||||
char preset_path[PATH_MAX_LENGTH];
|
||||
const char *shader_dir = *settings->directory.video_shader ?
|
||||
char preset_path[PATH_MAX_LENGTH] = {0};
|
||||
const char *shader_dir =
|
||||
*settings->directory.video_shader ?
|
||||
settings->directory.video_shader : settings->directory.system;
|
||||
|
||||
fill_pathname_join(preset_path, shader_dir,
|
||||
|
|
|
@ -57,9 +57,9 @@ static int file_decompressed_subdir(const char *name,
|
|||
unsigned cmode, uint32_t csize,uint32_t size,
|
||||
uint32_t crc32, void *userdata)
|
||||
{
|
||||
char path[PATH_MAX_LENGTH];
|
||||
char path_dir[PATH_MAX_LENGTH];
|
||||
decompress_state_t *dec = (decompress_state_t*)userdata;
|
||||
char path[PATH_MAX_LENGTH] = {0};
|
||||
decompress_state_t *dec = (decompress_state_t*)userdata;
|
||||
|
||||
/* Ignore directories. */
|
||||
if (name[strlen(name) - 1] == '/' || name[strlen(name) - 1] == '\\')
|
||||
|
@ -98,8 +98,8 @@ static int file_decompressed(const char *name, const char *valid_exts,
|
|||
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
||||
uint32_t crc32, void *userdata)
|
||||
{
|
||||
char path[PATH_MAX_LENGTH];
|
||||
decompress_state_t *dec = (decompress_state_t*)userdata;
|
||||
char path[PATH_MAX_LENGTH] = {0};
|
||||
decompress_state_t *dec = (decompress_state_t*)userdata;
|
||||
|
||||
/* Ignore directories. */
|
||||
if (name[strlen(name) - 1] == '/' || name[strlen(name) - 1] == '\\')
|
||||
|
|
|
@ -56,8 +56,8 @@
|
|||
static bool screenshot_dump(const char *folder, const void *frame,
|
||||
unsigned width, unsigned height, int pitch, bool bgr24)
|
||||
{
|
||||
char shotname[256];
|
||||
char filename[PATH_MAX_LENGTH];
|
||||
char shotname[256] = {0};
|
||||
bool ret = false;
|
||||
settings_t *settings = config_get_ptr();
|
||||
#if defined(HAVE_ZLIB_DEFLATE) && defined(HAVE_RPNG)
|
||||
|
|
Loading…
Add table
Reference in a new issue