Fix: add missing NULL check after allocation
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 19 Nov 2013 02:07:13 +0000 (21:07 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 19 Nov 2013 02:07:54 +0000 (21:07 -0500)
Found by coverity:

** CID 1021246:  Dereference null return value  (NULL_RETURNS)
/libringbuffer/shm.c: 80 in shm_object_table_create()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
libringbuffer/shm.c

index 995665ae16f4ee0b4836b3ffaf047bfb76ec3193..3bf648d253bd4f00ad8791b34cecb3d75e0c19d2 100644 (file)
@@ -77,6 +77,8 @@ struct shm_object_table *shm_object_table_create(size_t max_nb_obj)
 
        table = zmalloc(sizeof(struct shm_object_table) +
                        max_nb_obj * sizeof(table->objects[0]));
+       if (!table)
+               return NULL;
        table->size = max_nb_obj;
        return table;
 }
This page took 0.025474 seconds and 4 git commands to generate.