summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ring.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ring.c b/ring.c
index 620f490..5fb9daa 100644
--- a/ring.c
+++ b/ring.c
@@ -67,11 +67,11 @@ size_t ringConsumer(const char *name) {
 
 	if (consumers.len == consumers.cap) {
 		consumers.cap = (consumers.cap ? consumers.cap * 2 : 8);
-		// FIXME: Keep old pointer around for saving when exiting for error.
-		consumers.ptr = realloc(
+		void *ptr = realloc(
 			consumers.ptr, sizeof(*consumers.ptr) * consumers.cap
 		);
-		if (!consumers.ptr) err(EX_OSERR, "realloc");
+		if (!ptr) err(EX_OSERR, "realloc");
+		consumers.ptr = ptr;
 	}
 
 	struct Consumer *consumer = &consumers.ptr[consumers.len];