summaryrefslogtreecommitdiffstats
path: root/osdep/getch2-win.c
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/getch2-win.c')
-rw-r--r--osdep/getch2-win.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/osdep/getch2-win.c b/osdep/getch2-win.c
index 1882bb419d..9dae9cd91d 100644
--- a/osdep/getch2-win.c
+++ b/osdep/getch2-win.c
@@ -25,6 +25,7 @@
#include "config.h"
#include <stdio.h>
+#include <string.h>
#include <windows.h>
#include "keycodes.h"
#include "input/input.h"
@@ -189,7 +190,7 @@ static const struct {
char* get_term_charset(void)
{
- static char codepage[10];
+ char codepage[10];
unsigned i, cpno = GetConsoleOutputCP();
if (!cpno)
cpno = GetACP();
@@ -198,9 +199,9 @@ char* get_term_charset(void)
for (i = 0; cp_alias[i].cp; i++)
if (cpno == cp_alias[i].cp)
- return cp_alias[i].alias;
+ return strdup(cp_alias[i].alias);
snprintf(codepage, sizeof(codepage), "CP%u", cpno);
- return codepage;
+ return strdup(codepage);
}
#endif