Fix NULL dereference in buffer-based allocator
diff --git a/library/memory_buffer_alloc.c b/library/memory_buffer_alloc.c
index 4f96018..9cae251 100644
--- a/library/memory_buffer_alloc.c
+++ b/library/memory_buffer_alloc.c
@@ -484,7 +484,8 @@
     if( old == NULL )
     {
         hdr->next_free = heap.first_free;
-        heap.first_free->prev_free = hdr;
+        if( heap.first_free != NULL )
+            heap.first_free->prev_free = hdr;
         heap.first_free = hdr;
     }