From 58aceac8024e7ec6a5deb9de8c5e71b1e24aa04b Mon Sep 17 00:00:00 2001 From: Alessandro Mauri Date: Thu, 23 Apr 2020 18:59:14 +0200 Subject: [PATCH] justified exit condition --- macrod.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/macrod.c b/macrod.c index 08bb5dc..41bb4fc 100644 --- a/macrod.c +++ b/macrod.c @@ -256,9 +256,10 @@ int pressBufferRemove (struct pressed_buffer *pb, unsigned short key) pb->buf[i] = pb->buf[pb->size]; unsigned short *b; b = realloc(pb->buf, sizeof(unsigned short) * pb->size); + /* if realloc failed but the buffer is populated throw an error */ if (!b && pb->size) { fprintf(stderr, "realloc failed in pressBufferRemove: %s", - strerror(errno)); + strerror(errno)); exit(errno); } pb->buf = b;