home · contact · privacy
Added diagonal movement, with a 1.4 penalty.
[plomrogue] / src / server / io.c
index 10fcd90f3dca2da736f13b1fd2a9e21da93d9efc..817d54253c40f69edc2225ef7f53e4769d15e78b 100644 (file)
@@ -4,7 +4,7 @@
 #include <errno.h> /* global errno */
 #include <fcntl.h> /* open(), O_RDONLY, O_NONBLOCK */
 #include <limits.h> /* PIPE_BUF */
-#include <stddef.h> /* size_t */
+#include <stddef.h> /* size_t, NULL */
 #include <stdint.h> /* uint8_t, uint16_t, uint32_t */
 #include <stdio.h> /* define FILE, sprintf() */
 #include <stdlib.h> /* free() */
@@ -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
     {