mirror of
https://github.com/libretro/RetroArch.git
synced 2024-06-02 19:57:24 -04:00
Silence some MSVC 2019 code analysis warnings
This commit is contained in:
parent
97c5c269a7
commit
460f5e745d
|
@ -304,6 +304,8 @@ static void cheat_manager_free(void)
|
|||
free(cheat_st->cheats[i].desc);
|
||||
if (cheat_st->cheats[i].code)
|
||||
free(cheat_st->cheats[i].code);
|
||||
cheat_st->cheats[i].desc = NULL;
|
||||
cheat_st->cheats[i].code = NULL;
|
||||
}
|
||||
|
||||
free(cheat_st->cheats);
|
||||
|
@ -560,6 +562,8 @@ bool cheat_manager_realloc(unsigned new_size, unsigned default_handler)
|
|||
free(cheat_st->cheats[i].code);
|
||||
if (cheat_st->cheats[i].desc)
|
||||
free(cheat_st->cheats[i].desc);
|
||||
cheat_st->cheats[i].code = NULL;
|
||||
cheat_st->cheats[i].desc = NULL;
|
||||
}
|
||||
|
||||
val = (struct item_cheat*)
|
||||
|
|
|
@ -664,10 +664,10 @@ bool rcheevos_unload(void)
|
|||
rcheevos_locals.hardcore_active = false;
|
||||
}
|
||||
|
||||
while (rcheevos_locals.game.hashes != NULL)
|
||||
while (rcheevos_locals.game.hashes)
|
||||
{
|
||||
rcheevos_hash_entry_t* hash_entry = rcheevos_locals.game.hashes;
|
||||
rcheevos_locals.game.hashes = hash_entry->next;
|
||||
rcheevos_locals.game.hashes = hash_entry->next;
|
||||
free(hash_entry);
|
||||
}
|
||||
|
||||
|
|
|
@ -334,6 +334,14 @@ command_t* command_stdin_new(void)
|
|||
|
||||
cmd = (command_t*)calloc(1, sizeof(command_t));
|
||||
stdincmd = (command_stdin_t*)calloc(1, sizeof(command_stdin_t));
|
||||
|
||||
if (!cmd)
|
||||
return NULL;
|
||||
if (!stdincmd)
|
||||
{
|
||||
free(cmd);
|
||||
return NULL;
|
||||
}
|
||||
cmd->userptr = stdincmd;
|
||||
cmd->poll = command_stdin_poll;
|
||||
cmd->replier = stdin_command_reply;
|
||||
|
|
11
core_info.c
11
core_info.c
|
@ -790,6 +790,9 @@ static core_info_cache_list_t *core_info_cache_read(const char *info_dir)
|
|||
free(context.core_info);
|
||||
}
|
||||
|
||||
if (!core_info_cache_list)
|
||||
goto end;
|
||||
|
||||
/* If info cache file has the wrong version
|
||||
* number, discard it */
|
||||
if (string_is_empty(core_info_cache_list->version) ||
|
||||
|
@ -1881,8 +1884,12 @@ static void core_info_free(core_info_t* info)
|
|||
|
||||
for (i = 0; i < info->firmware_count; i++)
|
||||
{
|
||||
free(info->firmware[i].path);
|
||||
free(info->firmware[i].desc);
|
||||
if (info->firmware[i].path)
|
||||
free(info->firmware[i].path);
|
||||
if (info->firmware[i].desc)
|
||||
free(info->firmware[i].desc);
|
||||
info->firmware[i].path = NULL;
|
||||
info->firmware[i].desc = NULL;
|
||||
}
|
||||
free(info->firmware);
|
||||
|
||||
|
|
|
@ -737,7 +737,7 @@ static bool core_option_manager_parse_variable(
|
|||
value, NULL);
|
||||
|
||||
/* Set value hash */
|
||||
*value_hash = core_option_manager_hash_string(value);
|
||||
*value_hash = core_option_manager_hash_string(value);
|
||||
option->vals->elems[i].userdata = (void*)value_hash;
|
||||
|
||||
/* Redundant safely check... */
|
||||
|
|
|
@ -520,6 +520,26 @@ database_info_list_t *database_info_list_new(
|
|||
free(db_info.md5);
|
||||
if (db_info.sha1)
|
||||
free(db_info.sha1);
|
||||
|
||||
db_info.name = NULL;
|
||||
db_info.rom_name = NULL;
|
||||
db_info.serial = NULL;
|
||||
db_info.genre = NULL;
|
||||
db_info.description = NULL;
|
||||
db_info.publisher = NULL;
|
||||
db_info.developer = NULL;
|
||||
db_info.origin = NULL;
|
||||
db_info.franchise = NULL;
|
||||
db_info.edge_magazine_review = NULL;
|
||||
db_info.cero_rating = NULL;
|
||||
db_info.pegi_rating = NULL;
|
||||
db_info.enhancement_hw = NULL;
|
||||
db_info.elspa_rating = NULL;
|
||||
db_info.esrb_rating = NULL;
|
||||
db_info.bbfc_rating = NULL;
|
||||
db_info.sha1 = NULL;
|
||||
db_info.md5 = NULL;
|
||||
|
||||
database_info_list_free(database_info_list);
|
||||
free(database_info);
|
||||
free(database_info_list);
|
||||
|
@ -576,7 +596,6 @@ void database_info_list_free(database_info_list_t *database_info_list)
|
|||
free(info->publisher);
|
||||
if (info->developer)
|
||||
string_list_free(info->developer);
|
||||
info->developer = NULL;
|
||||
if (info->origin)
|
||||
free(info->origin);
|
||||
if (info->franchise)
|
||||
|
@ -600,6 +619,25 @@ void database_info_list_free(database_info_list_t *database_info_list)
|
|||
free(info->sha1);
|
||||
if (info->md5)
|
||||
free(info->md5);
|
||||
|
||||
info->name = NULL;
|
||||
info->rom_name = NULL;
|
||||
info->serial = NULL;
|
||||
info->genre = NULL;
|
||||
info->description = NULL;
|
||||
info->publisher = NULL;
|
||||
info->developer = NULL;
|
||||
info->origin = NULL;
|
||||
info->franchise = NULL;
|
||||
info->edge_magazine_review = NULL;
|
||||
info->cero_rating = NULL;
|
||||
info->pegi_rating = NULL;
|
||||
info->enhancement_hw = NULL;
|
||||
info->elspa_rating = NULL;
|
||||
info->esrb_rating = NULL;
|
||||
info->bbfc_rating = NULL;
|
||||
info->sha1 = NULL;
|
||||
info->md5 = NULL;
|
||||
}
|
||||
|
||||
free(database_info_list->list);
|
||||
|
|
5
deps/7zip/7zFile.c
vendored
5
deps/7zip/7zFile.c
vendored
|
@ -212,9 +212,8 @@ WRes File_Seek(CSzFile *p, int64_t *pos, ESzSeek origin)
|
|||
WRes File_GetLength(CSzFile *p, uint64_t *length)
|
||||
{
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
|
||||
DWORD sizeHigh;
|
||||
DWORD sizeLow = GetFileSize(p->handle, &sizeHigh);
|
||||
DWORD sizeHigh = 0;
|
||||
DWORD sizeLow = GetFileSize(p->handle, &sizeHigh);
|
||||
if (sizeLow == 0xFFFFFFFF)
|
||||
{
|
||||
DWORD res = GetLastError();
|
||||
|
|
23
driver.c
23
driver.c
|
@ -810,18 +810,19 @@ void retroarch_deinit_drivers(struct retro_callbacks *cbs)
|
|||
audio_state_get_ptr()->active = false;
|
||||
audio_state_get_ptr()->current_audio = NULL;
|
||||
|
||||
/* Input */
|
||||
input_st->keyboard_linefeed_enable = false;
|
||||
input_st->block_hotkey = false;
|
||||
input_st->block_libretro_input = false;
|
||||
|
||||
if (input_st)
|
||||
input_st->nonblocking_flag = false;
|
||||
|
||||
memset(&input_st->turbo_btns, 0, sizeof(turbo_buttons_t));
|
||||
memset(&input_st->analog_requested, 0,
|
||||
if (input_st)
|
||||
{
|
||||
/* Input */
|
||||
input_st->keyboard_linefeed_enable = false;
|
||||
input_st->block_hotkey = false;
|
||||
input_st->block_libretro_input = false;
|
||||
input_st->nonblocking_flag = false;
|
||||
|
||||
memset(&input_st->turbo_btns, 0, sizeof(turbo_buttons_t));
|
||||
memset(&input_st->analog_requested, 0,
|
||||
sizeof(input_st->analog_requested));
|
||||
input_st->current_driver = NULL;
|
||||
input_st->current_driver = NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_destroy(
|
||||
|
|
|
@ -457,6 +457,9 @@ static void d3d11_free_shader_preset(d3d11_video_t* d3d11)
|
|||
free(d3d11->shader_preset->pass[i].source.string.vertex);
|
||||
free(d3d11->shader_preset->pass[i].source.string.fragment);
|
||||
free(d3d11->pass[i].semantics.textures);
|
||||
d3d11->shader_preset->pass[i].source.string.vertex = NULL;
|
||||
d3d11->shader_preset->pass[i].source.string.fragment = NULL;
|
||||
d3d11->pass[i].semantics.textures = NULL;
|
||||
d3d11_release_shader(&d3d11->pass[i].shader);
|
||||
d3d11_release_texture(&d3d11->pass[i].rt);
|
||||
d3d11_release_texture(&d3d11->pass[i].feedback);
|
||||
|
@ -464,6 +467,7 @@ static void d3d11_free_shader_preset(d3d11_video_t* d3d11)
|
|||
for (j = 0; j < SLANG_CBUFFER_MAX; j++)
|
||||
{
|
||||
free(d3d11->pass[i].semantics.cbuffers[j].uniforms);
|
||||
d3d11->pass[i].semantics.cbuffers[j].uniforms = NULL;
|
||||
Release(d3d11->pass[i].buffers[j]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -458,12 +458,16 @@ static void d3d12_free_shader_preset(d3d12_video_t* d3d12)
|
|||
free(d3d12->shader_preset->pass[i].source.string.vertex);
|
||||
free(d3d12->shader_preset->pass[i].source.string.fragment);
|
||||
free(d3d12->pass[i].semantics.textures);
|
||||
d3d12->shader_preset->pass[i].source.string.vertex = NULL;
|
||||
d3d12->shader_preset->pass[i].source.string.fragment = NULL;
|
||||
d3d12->pass[i].semantics.textures = NULL;
|
||||
d3d12_release_texture(&d3d12->pass[i].rt);
|
||||
d3d12_release_texture(&d3d12->pass[i].feedback);
|
||||
|
||||
for (j = 0; j < SLANG_CBUFFER_MAX; j++)
|
||||
{
|
||||
free(d3d12->pass[i].semantics.cbuffers[j].uniforms);
|
||||
d3d12->pass[i].semantics.cbuffers[j].uniforms = NULL;
|
||||
Release(d3d12->pass[i].buffers[j]);
|
||||
}
|
||||
|
||||
|
@ -1016,8 +1020,7 @@ static bool d3d12_gfx_init_pipelines(d3d12_video_t* d3d12)
|
|||
|
||||
desc.CS.pShaderBytecode = D3DGetBufferPointer(cs_code);
|
||||
desc.CS.BytecodeLength = D3DGetBufferSize(cs_code);
|
||||
if (!D3D12CreateComputePipelineState(d3d12->device, &desc, &d3d12->mipmapgen_pipe))
|
||||
|
||||
if (FAILED(D3D12CreateComputePipelineState(d3d12->device, &desc, &d3d12->mipmapgen_pipe)))
|
||||
Release(cs_code);
|
||||
cs_code = NULL;
|
||||
}
|
||||
|
|
|
@ -242,6 +242,7 @@ void bitmapfont_free_lut(bitmapfont_lut_t *font)
|
|||
{
|
||||
if (font->lut[i])
|
||||
free(font->lut[i]);
|
||||
font->lut[i] = NULL;
|
||||
}
|
||||
|
||||
free(font->lut);
|
||||
|
|
|
@ -132,12 +132,15 @@ audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate,
|
|||
chunk->resample_buf = NULL;
|
||||
chunk->len = 0;
|
||||
chunk->resample_len = 0;
|
||||
chunk->rwav = (rwav_t*)malloc(sizeof(rwav_t));
|
||||
chunk->sample_rate = sample_rate;
|
||||
chunk->resample = false;
|
||||
chunk->resampler = NULL;
|
||||
chunk->resampler_data = NULL;
|
||||
chunk->ratio = 0.00f;
|
||||
chunk->rwav = (rwav_t*)malloc(sizeof(rwav_t));
|
||||
|
||||
if (!chunk->rwav)
|
||||
goto error;
|
||||
|
||||
chunk->rwav->bitspersample = 0;
|
||||
chunk->rwav->numchannels = 0;
|
||||
|
@ -147,19 +150,13 @@ audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate,
|
|||
chunk->rwav->samples = NULL;
|
||||
|
||||
if (!filestream_read_file(path, &buf, &len))
|
||||
{
|
||||
printf("Could not open WAV file for reading.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
chunk->buf = buf;
|
||||
chunk->len = len;
|
||||
|
||||
if (rwav_load(chunk->rwav, chunk->buf, chunk->len) == RWAV_ITERATE_ERROR)
|
||||
{
|
||||
printf("error: could not load WAV file\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* numsamples does not know or care about
|
||||
* multiple channels, but we need space for 2 */
|
||||
|
@ -222,7 +219,6 @@ audio_chunk_t* audio_mix_load_wav_file(const char *path, int sample_rate,
|
|||
else if (sample_size != 2)
|
||||
{
|
||||
/* we don't support any other sample size besides 8 and 16-bit yet */
|
||||
printf("error: we don't support a sample size of %d\n", sample_size);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,8 @@ chdstream_get_meta(chd_file *chd, int idx, metadata_t *md)
|
|||
uint32_t meta_size = 0;
|
||||
chd_error err;
|
||||
|
||||
meta[0] = '\0';
|
||||
|
||||
memset(md, 0, sizeof(*md));
|
||||
|
||||
err = chd_get_metadata(chd, CDROM_TRACK_METADATA2_TAG, idx, meta,
|
||||
|
|
|
@ -376,9 +376,7 @@ libretro_vfs_implementation_file* retro_vfs_file_open_impl(
|
|||
break;
|
||||
}
|
||||
if (mode == RETRO_VFS_FILE_ACCESS_READ)
|
||||
{
|
||||
creationDisposition = OPEN_EXISTING;
|
||||
}
|
||||
else
|
||||
{
|
||||
creationDisposition = (mode & RETRO_VFS_FILE_ACCESS_UPDATE_EXISTING) != 0 ?
|
||||
|
@ -386,20 +384,15 @@ libretro_vfs_implementation_file* retro_vfs_file_open_impl(
|
|||
}
|
||||
HANDLE file_handle = CreateFile2FromAppW(path_wstring.data(), desireAccess, FILE_SHARE_READ, creationDisposition, NULL);
|
||||
if (file_handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
stream->fh = file_handle;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
stream->fd = _open_osfhandle((uint64)stream->fh, flags);
|
||||
if (stream->fd == -1)
|
||||
goto error;
|
||||
else
|
||||
{
|
||||
FILE* fp;
|
||||
fp = _fdopen(stream->fd, mode_str);
|
||||
FILE *fp = _fdopen(stream->fd, mode_str);
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
|
|
|
@ -6003,8 +6003,8 @@ static void netplay_refresh_lan_cb(retro_task_t *task,
|
|||
struct netplay_host *host = &hosts->hosts[i];
|
||||
struct netplay_room *room = &net_st->room_list[i];
|
||||
|
||||
room->port = host->port;
|
||||
room->gamecrc = host->content_crc;
|
||||
room->port = host->port;
|
||||
room->gamecrc = host->content_crc;
|
||||
strlcpy(room->retroarch_version, host->retroarch_version,
|
||||
sizeof(room->retroarch_version));
|
||||
strlcpy(room->nickname, host->nick,
|
||||
|
|
|
@ -2160,9 +2160,10 @@ static void materialui_free_playlist_icon_list(materialui_handle_t *mui)
|
|||
/* Free file names */
|
||||
if (mui->textures.playlist.icons[i].playlist_file)
|
||||
free(mui->textures.playlist.icons[i].playlist_file);
|
||||
|
||||
if (mui->textures.playlist.icons[i].image_file)
|
||||
free(mui->textures.playlist.icons[i].image_file);
|
||||
mui->textures.playlist.icons[i].playlist_file = NULL;
|
||||
mui->textures.playlist.icons[i].image_file = NULL;
|
||||
}
|
||||
|
||||
/* Free icons array and set list size to zero */
|
||||
|
|
|
@ -5951,14 +5951,17 @@ static void *rgui_init(void **userdata, bool video_is_threaded)
|
|||
return menu;
|
||||
|
||||
error:
|
||||
rgui_fonts_free(rgui);
|
||||
if (rgui)
|
||||
{
|
||||
rgui_fonts_free(rgui);
|
||||
|
||||
rgui_framebuffer_free(&rgui->frame_buf);
|
||||
rgui_framebuffer_free(&rgui->background_buf);
|
||||
rgui_framebuffer_free(&rgui->frame_buf);
|
||||
rgui_framebuffer_free(&rgui->background_buf);
|
||||
|
||||
rgui_thumbnail_free(&rgui->fs_thumbnail);
|
||||
rgui_thumbnail_free(&rgui->mini_thumbnail);
|
||||
rgui_thumbnail_free(&rgui->mini_left_thumbnail);
|
||||
rgui_thumbnail_free(&rgui->fs_thumbnail);
|
||||
rgui_thumbnail_free(&rgui->mini_thumbnail);
|
||||
rgui_thumbnail_free(&rgui->mini_left_thumbnail);
|
||||
}
|
||||
|
||||
if (menu)
|
||||
free(menu);
|
||||
|
@ -5977,17 +5980,17 @@ static void rgui_free(void *data)
|
|||
#endif
|
||||
if (rgui->thumbnail_path_data)
|
||||
free(rgui->thumbnail_path_data);
|
||||
|
||||
rgui_fonts_free(rgui);
|
||||
|
||||
rgui_framebuffer_free(&rgui->frame_buf);
|
||||
rgui_framebuffer_free(&rgui->background_buf);
|
||||
rgui_framebuffer_free(&rgui->upscale_buf);
|
||||
|
||||
rgui_thumbnail_free(&rgui->fs_thumbnail);
|
||||
rgui_thumbnail_free(&rgui->mini_thumbnail);
|
||||
rgui_thumbnail_free(&rgui->mini_left_thumbnail);
|
||||
}
|
||||
|
||||
rgui_fonts_free(rgui);
|
||||
|
||||
rgui_framebuffer_free(&rgui->frame_buf);
|
||||
rgui_framebuffer_free(&rgui->background_buf);
|
||||
rgui_framebuffer_free(&rgui->upscale_buf);
|
||||
|
||||
rgui_thumbnail_free(&rgui->fs_thumbnail);
|
||||
rgui_thumbnail_free(&rgui->mini_thumbnail);
|
||||
rgui_thumbnail_free(&rgui->mini_left_thumbnail);
|
||||
}
|
||||
|
||||
static void rgui_set_texture(void *data)
|
||||
|
|
|
@ -84,6 +84,7 @@ static void contentless_cores_free_info_entries(
|
|||
|
||||
if (entry->licenses_str)
|
||||
free(entry->licenses_str);
|
||||
entry->licenses_str = NULL;
|
||||
|
||||
contentless_cores_free_runtime_info(&entry->runtime);
|
||||
|
||||
|
|
|
@ -208,6 +208,9 @@ static void *state_manager_raw_alloc(size_t len, uint16_t uniq)
|
|||
size_t len16 = (len + sizeof(uint16_t) - 1) & -sizeof(uint16_t);
|
||||
uint16_t *ret = (uint16_t*)calloc(len16 + sizeof(uint16_t) * 4 + 16, 1);
|
||||
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
/* Force in a different byte at the end, so we don't need to check
|
||||
* bounds in the innermost loop (it's expensive).
|
||||
*
|
||||
|
|
|
@ -166,10 +166,10 @@ static void content_file_override_free(
|
|||
content_file_override_t *override =
|
||||
&p_content->content_override_list[i];
|
||||
|
||||
if (!override || !override->ext)
|
||||
if (!override)
|
||||
continue;
|
||||
|
||||
free(override->ext);
|
||||
if (override->ext)
|
||||
free(override->ext);
|
||||
}
|
||||
|
||||
RBUF_FREE(p_content->content_override_list);
|
||||
|
|
|
@ -938,7 +938,7 @@ bool task_push_core_restore(const char *backup_path, const char *dir_libretro,
|
|||
retro_task_t *task = NULL;
|
||||
core_backup_handle_t *backup_handle = NULL;
|
||||
char core_path[PATH_MAX_LENGTH];
|
||||
char task_title[PATH_MAX_LENGTH];
|
||||
char task_title[256];
|
||||
|
||||
core_path[0] = '\0';
|
||||
task_title[0] = '\0';
|
||||
|
|
|
@ -540,7 +540,10 @@ bool content_undo_load_state(void)
|
|||
}
|
||||
|
||||
for (i = 0; i < num_blocks; i++)
|
||||
{
|
||||
free(blocks[i].data);
|
||||
blocks[i].data = NULL;
|
||||
}
|
||||
free(blocks);
|
||||
|
||||
if (!ret)
|
||||
|
|
Loading…
Reference in a new issue