Fix Bug #11955.
[pspp-builds.git] / src / pool.c
index 336671e2bcd6b84c868f380e95608dbc76ad47b8..41d4e74862cf703bc738039025e17d8818a9c102 100644 (file)
@@ -21,7 +21,7 @@
 #include <config.h>
 #endif
 #include "pool.h"
-#include <assert.h>
+#include "error.h"
 #include <stdlib.h>
 #include "alloc.h"
 #include "str.h"
@@ -302,6 +302,8 @@ pool_strndup (struct pool *pool, const char *string, size_t length)
         copy = ((char *) b) + b->ofs;
         b->ofs += size;
       }
+    else
+      copy = pool_alloc (pool, size);
   }
 #else
   copy = pool_alloc (pool, size);
@@ -641,6 +643,7 @@ free_all_gizmos (struct pool *pool)
       next = cur->next;
       free_gizmo (cur);
     }
+  pool->gizmos=NULL;
 }
 \f
 /* Memory allocation. */