diff --git a/command.c b/command.c index 4459b7f87c..8d38e8d400 100644 --- a/command.c +++ b/command.c @@ -2088,9 +2088,9 @@ bool command_event(enum event_command cmd, void *data) break; case CMD_EVENT_CORE_DEINIT: { + struct retro_hw_render_callback *hwr = NULL; content_reset_savestate_backups(); - struct retro_hw_render_callback *hwr = - video_driver_get_hw_context(); + hwr = video_driver_get_hw_context(); command_event_deinit_core(true); if (hwr) diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c index 0d7b72d6be..acf5fa9f6f 100644 --- a/frontend/drivers/platform_linux.c +++ b/frontend/drivers/platform_linux.c @@ -1912,14 +1912,16 @@ static void frontend_linux_exitspawn(char *core_path, size_t core_path_size) static uint64_t frontend_linux_get_mem_total(void) { - FILE* data = fopen("/proc/meminfo", "r"); + char line[256]; + uint64_t total = 0; + FILE * data = fopen("/proc/meminfo", "r"); if (!data) return 0; - char line[256]; - uint64_t total = 0; - while (fgets(line, sizeof(line), data)) { - if (sscanf(line, "MemTotal: " STRING_REP_ULONG " kB", &total) == 1) { + while (fgets(line, sizeof(line), data)) + { + if (sscanf(line, "MemTotal: " STRING_REP_ULONG " kB", &total) == 1) + { fclose(data); total *= 1024; return total; @@ -1932,16 +1934,15 @@ static uint64_t frontend_linux_get_mem_total(void) static uint64_t frontend_linux_get_mem_used(void) { - FILE* data = fopen("/proc/meminfo", "r"); - if (!data) - return 0; - + char line[256]; uint64_t total = 0; uint64_t freemem = 0; uint64_t buffers = 0; uint64_t cached = 0; + FILE* data = fopen("/proc/meminfo", "r"); + if (!data) + return 0; - char line[256]; while (fgets(line, sizeof(line), data)) { if (sscanf(line, "MemTotal: " STRING_REP_ULONG " kB", &total) == 1) diff --git a/tasks/task_save_state.c b/tasks/task_save_state.c index a403331d56..dfca5c804e 100644 --- a/tasks/task_save_state.c +++ b/tasks/task_save_state.c @@ -68,14 +68,13 @@ struct sram_block bool content_undo_load_state() { unsigned i; - //ssize_t size; retro_ctx_serialize_info_t serial_info; + size_t temp_data_size; + void* temp_data = NULL; unsigned num_blocks = 0; - //void *buf = NULL; struct sram_block *blocks = NULL; settings_t *settings = config_get_ptr(); global_t *global = global_get_ptr(); - //bool ret = filestream_read_file(path, &buf, &size); RARCH_LOG("%s: \"%s\".\n", msg_hash_to_str(MSG_LOADING_STATE), @@ -138,8 +137,8 @@ bool content_undo_load_state() } /* We need to make a temporary copy of the buffer, to allow the swap below */ - void* temp_data = malloc(undo_load_buf.size); - size_t temp_data_size = undo_load_buf.size; + temp_data = malloc(undo_load_buf.size); + temp_data_size = undo_load_buf.size; memcpy(temp_data, undo_load_buf.data, undo_load_buf.size); serial_info.data_const = temp_data;