aboutsummaryrefslogtreecommitdiff
path: root/src/ui_input.c
diff options
context:
space:
mode:
authortoni <matzeton@googlemail.com>2016-07-25 01:38:10 +0200
committertoni <matzeton@googlemail.com>2016-07-25 01:38:10 +0200
commit19ec491f008b94261bbcaf8f432a544912fc96a9 (patch)
treecd25088187c2c918d62304f3f8123da57191b45c /src/ui_input.c
parent9cc42e573c1d28a71df6ca96131b8b14aff7639e (diff)
bugfixes, use alloca(...) for tmp varaibles
Diffstat (limited to 'src/ui_input.c')
-rw-r--r--src/ui_input.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ui_input.c b/src/ui_input.c
index 9c53330..4ba4769 100644
--- a/src/ui_input.c
+++ b/src/ui_input.c
@@ -1,5 +1,6 @@
#include <stdlib.h>
#include <string.h>
+#include <alloca.h>
#include "ui.h"
#include "ui_input.h"
@@ -106,16 +107,16 @@ print_input(WINDOW *win, struct input *a)
} else {
mvprintw(a->y, a->x, a->prompt);
}
- tmp = calloc(a->width+1, sizeof(char));
+ tmp = alloca(a->width+1 * sizeof(char));
for (i = 0; i < a->width; i++) {
*(tmp + i) = '_';
}
+ tmp[i] = '\0';
if (win) {
mvwprintw(win, a->y, a->x + p_len, tmp);
} else {
mvprintw(a->y, a->x + p_len, tmp);
}
- free(tmp);
print_input_text(win, a);
attroff(a->attrs);
}