]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
contrib/ucw: fixed bad malloc retval check
authorMarek Vavruša <marek.vavrusa@nic.cz>
Sat, 28 Nov 2015 20:34:13 +0000 (21:34 +0100)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Sat, 28 Nov 2015 20:34:13 +0000 (21:34 +0100)
contrib/ucw/mempool.c

index 7abac9ff80946edc676920dd0d3c2c80785e6b59..f50c453a2b3a590aae0799b577e3173a26fe4a7a 100644 (file)
@@ -86,9 +86,10 @@ static void *
 mp_new_big_chunk(struct mempool *pool, size_t size)
 {
   struct mempool_chunk *chunk;
-  chunk = malloc(size + MP_CHUNK_TAIL) + size;
+  chunk = malloc(size + MP_CHUNK_TAIL);
   if (!chunk)
     return NULL;
+  chunk = (struct mempool_chunk *)((char *)chunk + size);
   chunk->size = size;
   if (pool)
     pool->total_size += size + MP_CHUNK_TAIL;