atomicqueue: use correct array sizes
diff --git a/gst/gstatomicqueue.c b/gst/gstatomicqueue.c
index e6c9e58..f1cb475 100644
--- a/gst/gstatomicqueue.c
+++ b/gst/gstatomicqueue.c
@@ -80,7 +80,7 @@
 
   /* we keep the size as a mask for performance */
   mem->size = clp2 (MAX (size, 16)) - 1;
-  mem->array = g_new0 (gpointer, mem->size);
+  mem->array = g_new0 (gpointer, mem->size + 1);
   mem->head = pos;
   mem->tail = pos;
   mem->next = NULL;
@@ -345,7 +345,7 @@
       size = tail_mem->size;
 
       /* we're not full, continue */
-      if (tail - head < size)
+      if (tail - head <= size)
         break;
 
       /* else we need to grow the array, we store a mask so we have to add 1 */