From 286aff8a81d0c313cc763494a0bd0585db9b25dd Mon Sep 17 00:00:00 2001 From: Tatsuya Kinoshita Date: Tue, 29 Mar 2016 00:36:42 +0900 Subject: Fix realloc mistake for DrawImage --- w3mimgdisplay.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/w3mimgdisplay.c b/w3mimgdisplay.c index 5486a47..ccfa373 100644 --- a/w3mimgdisplay.c +++ b/w3mimgdisplay.c @@ -281,6 +281,10 @@ DrawImage(char *buf, int redraw) maxImage = n + 1; imageBuf = (W3MImage *) realloc((void *)imageBuf, sizeof(W3MImage) * maxImage); + if (imageBuf == NULL) { + fprintf(stderr, "Out of memory\n"); + exit(1); + } for (; i < maxImage; i++) imageBuf[i].pixmap = NULL; } -- cgit v1.2.3