Fix: use-after-free on error of lttng_event creation and copy
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 27 Aug 2018 19:41:51 +0000 (15:41 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 29 Aug 2018 20:36:06 +0000 (16:36 -0400)
Found by Coverity:
>>>     CID 1395219:  Memory - illegal accesses  (USE_AFTER_FREE)
>>>     Using freed pointer "new_event".

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/event.c
src/lib/lttng-ctl/event.c

index 329a8688db8672eb81e9feed541954a356cd1523..3849fd2f368db66d94e5bd6a95e897155d2d5731 100644 (file)
@@ -48,5 +48,6 @@ end:
        return new_event;
 error:
        free(new_event);
+       new_event = NULL;
        goto end;
 }
index f8abf309e5fe354ce45c69be446a7866fba3aefd..17dd7f72bfe8fd9bbe80c6ccd8afcb35b9d3d3f3 100644 (file)
@@ -51,6 +51,7 @@ end:
        return event;
 error:
        free(event);
+       event = NULL;
        goto end;
 }
 
This page took 0.027834 seconds and 4 git commands to generate.