From: Jérémie Galarneau Date: Mon, 6 Apr 2020 16:39:17 +0000 (-0400) Subject: Fix: relayd: unchecked allocation result of unlinked file pool X-Git-Tag: v2.13.0-rc1~675 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9604bd17bfb1f116b6d4e56ab1d95e08cde17a06;p=lttng-tools.git Fix: relayd: unchecked allocation result of unlinked file pool `pool` is not checked for NULL after its allocation. Error out if the allocation fails. In lttng_unlinked_file_pool_create: Return value of function which returns null is dereferenced without checking (CWE-476) Reported-by: Coverity Scan Signed-off-by: Jérémie Galarneau Change-Id: I2a7717701cf3d11de557b9ecdc6609c1f6a1fd6f --- diff --git a/src/common/fd-tracker/inode.c b/src/common/fd-tracker/inode.c index 82799aee7..f105f5bd3 100644 --- a/src/common/fd-tracker/inode.c +++ b/src/common/fd-tracker/inode.c @@ -250,6 +250,10 @@ LTTNG_HIDDEN struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create( { struct lttng_unlinked_file_pool *pool = zmalloc(sizeof(*pool)); + if (!pool) { + goto error; + } + if (!path || *path != '/') { ERR("Unlinked file pool must be created with an absolute path, path = \"%s\"", path ? path : "NULL");