diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-11-22 14:32:36 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-11-22 14:32:36 +0000 |
commit | e88a276d915109f397d404216e0aca2aeef952f2 (patch) | |
tree | 7b5db4fda680a5e49b273516200fed4d34c5cd05 /framebuffer/fbtk.c | |
parent | 2427ebea77e798206eabdb9dd194b8b8a5296825 (diff) | |
download | netsurf-e88a276d915109f397d404216e0aca2aeef952f2.tar.gz netsurf-e88a276d915109f397d404216e0aca2aeef952f2.tar.bz2 |
Actually check for realloc failing
svn path=/trunk/netsurf/; revision=9698
Diffstat (limited to 'framebuffer/fbtk.c')
-rw-r--r-- | framebuffer/fbtk.c | 15 |
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; } |