Allocate name_base memory and free it again

This commit is contained in:
twinaphex 2016-05-25 02:25:09 +02:00
parent 581f53a7c2
commit 8c106eb010

View File

@ -258,13 +258,16 @@ static bool take_screenshot_choice(const char *global_name_base)
bool take_screenshot(void)
{
global_t *global = global_get_ptr();
char *name_base = strdup(global->name.base);
bool is_paused = runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL);
bool ret = take_screenshot_choice(global->name.base);
bool ret = take_screenshot_choice(name_base);
const char *msg_screenshot = ret
? msg_hash_to_str(MSG_TAKING_SCREENSHOT) :
msg_hash_to_str(MSG_FAILED_TO_TAKE_SCREENSHOT);
const char *msg = msg_screenshot;
free(name_base);
runloop_msg_queue_push(msg, 1, is_paused ? 1 : 180, true);
if (is_paused)