summaryrefslogtreecommitdiff
path: root/framebuffer/fbtk.c
diff options
context:
space:
mode:
Diffstat (limited to 'framebuffer/fbtk.c')
-rw-r--r--framebuffer/fbtk.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/framebuffer/fbtk.c b/framebuffer/fbtk.c
index f980d6f5d..87d5d3650 100644
--- a/framebuffer/fbtk.c
+++ b/framebuffer/fbtk.c
@@ -671,10 +671,17 @@ text_input(fbtk_widget_t *widget, nsfb_event_t *event, void *pw)
default:
/* allow for new character and null */
- widget->u.text.text = realloc(widget->u.text.text, widget->u.text.idx + 2);
- widget->u.text.text[widget->u.text.idx] = value;
- widget->u.text.text[widget->u.text.idx + 1] = '\0';
- widget->u.text.idx++;
+ {
+ char *temp = realloc(widget->u.text.text,
+ widget->u.text.idx + 2);
+ if (temp != NULL) {
+ widget->u.text.text = temp;
+ widget->u.text.text[widget->u.text.idx] = value;
+ widget->u.text.text[widget->u.text.idx + 1] =
+ '\0';
+ widget->u.text.idx++;
+ }
+ }
break;
}