home · contact · privacy
Fixed some more pitfalls that hurt working with game maps of maximum size.
[plomrogue] / src / server / io.c
index 800f539aea747e53413f13d09fdc1cee7c823015..1de0bd07c9b6367fadc917bde2f19f500d341fdb 100644 (file)
@@ -5,7 +5,7 @@
 #include <fcntl.h> /* open(), O_RDONLY, O_NONBLOCK */
 #include <limits.h> /* PIPE_BUF */
 #include <stddef.h> /* size_t, NULL */
-#include <stdint.h> /* uint8_t, uint16_t, uint32_t */
+#include <stdint.h> /* uint8_t, uint32_t */
 #include <stdio.h> /* define FILE, sprintf() */
 #include <stdlib.h> /* free() */
 #include <string.h> /* strlen(), memset(), memcpy() */
@@ -66,8 +66,8 @@ static char * get_message_from_queue()
     world.queue_size = world.queue_size - cutout_len;
     if (0 == world.queue_size)
     {
-        free(world.queue);
-        world.queue = NULL;
+        free(world.queue);  /* NULL so read_fifo_into_queue() may free() this */
+        world.queue = NULL; /* every time, even when it's un-allocated first. */
     }
     else
     {