From: Francis Deslauriers Date: Mon, 27 Aug 2018 19:41:51 +0000 (-0400) Subject: Fix: use-after-free on error of lttng_event creation and copy X-Git-Tag: v2.11.0-rc1~50 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=37750a613e7dd881041ce7388beece11e027775f;p=lttng-tools.git Fix: use-after-free on error of lttng_event creation and copy Found by Coverity: >>> CID 1395219: Memory - illegal accesses (USE_AFTER_FREE) >>> Using freed pointer "new_event". Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/event.c b/src/common/event.c index 329a8688d..3849fd2f3 100644 --- a/src/common/event.c +++ b/src/common/event.c @@ -48,5 +48,6 @@ end: return new_event; error: free(new_event); + new_event = NULL; goto end; } diff --git a/src/lib/lttng-ctl/event.c b/src/lib/lttng-ctl/event.c index f8abf309e..17dd7f72b 100644 --- a/src/lib/lttng-ctl/event.c +++ b/src/lib/lttng-ctl/event.c @@ -51,6 +51,7 @@ end: return event; error: free(event); + event = NULL; goto end; }