Fix for coverity #29369 (another further down)
[supertux.git] / external / obstack / obstack.c
index 7f51a27..d4da534 100644 (file)
@@ -136,8 +136,10 @@ _obstack_begin (struct obstack *h,
   h->use_extra_arg = 0;
 
   chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
-  if (!chunk)
+  if (!chunk) {
     (*obstack_alloc_failed_handler) ();
+    return 0;
+  }
   h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
                                               alignment - 1);
   h->chunk_limit = chunk->limit
@@ -221,8 +223,10 @@ _obstack_newchunk (struct obstack *h, int length)
 
   /* Allocate and initialize the new chunk.  */
   new_chunk = CALL_CHUNKFUN (h, new_size);
-  if (!new_chunk)
+  if (!new_chunk) {
     (*obstack_alloc_failed_handler) ();
+    return;
+  }
   h->chunk = new_chunk;
   new_chunk->prev = old_chunk;
   new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;