From da1854316d2d3c331a691519f4815c8fd1de4b62 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 12 Mar 2012 11:05:46 +0100 Subject: [PATCH] gfio: prevent multitext crash on invalid update Signed-off-by: Jens Axboe --- gfio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gfio.c b/gfio.c index 6a227772..7f478282 100644 --- a/gfio.c +++ b/gfio.c @@ -263,7 +263,7 @@ static void multitext_set_entry(struct multitext_widget *mt, unsigned int index) { if (index >= mt->max_text) return; - if (!mt->text[index]) + if (!mt->text || !mt->text[index]) return; mt->cur_text = index; @@ -273,6 +273,9 @@ static void multitext_set_entry(struct multitext_widget *mt, unsigned int index) static void multitext_update_entry(struct multitext_widget *mt, unsigned int index, const char *text) { + if (!mt->text) + return; + if (mt->text[index]) free(mt->text[index]); -- 2.25.1