From: Mathieu Desnoyers Date: Tue, 19 Nov 2013 02:07:13 +0000 (-0500) Subject: Fix: add missing NULL check after allocation X-Git-Tag: v2.2.3~12 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=911360f660e1a4ad85813ae363168e1ddd558f67;p=lttng-ust.git Fix: add missing NULL check after allocation 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 --- diff --git a/libringbuffer/shm.c b/libringbuffer/shm.c index 995665ae..3bf648d2 100644 --- a/libringbuffer/shm.c +++ b/libringbuffer/shm.c @@ -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; }