commit 1b1e75c15550227a6ac1eb0737865262d042543f
parent 9a48529971d02ca1b0b58bccce55cb42fa5b05e7
Author: Claudio Alessi <smoppy@gmail.com>
Date: Sat, 23 Apr 2016 19:38:21 +0200
Make mode name as fixed size.
This also removes a memory leaks (missing free() call).
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/myadm.c b/myadm.c
@@ -68,7 +68,7 @@ typedef struct {
} Key;
typedef struct {
- char *name;
+ char name[16];
void (*func)(void);
} Mode;
@@ -599,7 +599,6 @@ newaview(const char *name, void (*func)(void)) {
v = ecalloc(1, sizeof(View));
v->mode = ecalloc(1, sizeof(Mode));
- v->mode->name = ecalloc(strlen(name)+1, sizeof(char));
v->choice = getitem(0);
strcpy(v->mode->name, name);
v->mode->func = func;