home · contact · privacy
Put points from a separately kept TODO file into the repository proper.
[plomrogue] / src / server / io.c
index 10fcd90f3dca2da736f13b1fd2a9e21da93d9efc..1de0bd07c9b6367fadc917bde2f19f500d341fdb 100644 (file)
@@ -4,8 +4,8 @@
 #include <errno.h> /* global errno */
 #include <fcntl.h> /* open(), O_RDONLY, O_NONBLOCK */
 #include <limits.h> /* PIPE_BUF */
-#include <stddef.h> /* size_t */
-#include <stdint.h> /* uint8_t, uint16_t, uint32_t */
+#include <stddef.h> /* size_t, NULL */
+#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
     {