From: Jérémie Galarneau Date: Fri, 24 Aug 2018 20:32:12 +0000 (-0400) Subject: Fix: event copy constructor frees original event on error X-Git-Tag: v2.11.0-rc1~61 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=1ebc45cd4c1b34fbaacb8b8403fbb5d3fab33d3f;p=lttng-tools.git Fix: event copy constructor frees original event on error Signed-off-by: Jérémie Galarneau --- diff --git a/src/lib/lttng-ctl/event.c b/src/lib/lttng-ctl/event.c index 44e4864c0..5785345cd 100644 --- a/src/lib/lttng-ctl/event.c +++ b/src/lib/lttng-ctl/event.c @@ -60,7 +60,7 @@ struct lttng_event *lttng_event_copy(const struct lttng_event *event) struct lttng_event_extended *new_event_extended; new_event = zmalloc(sizeof(*event)); - if (!event) { + if (!new_event) { PERROR("Error allocating event structure"); goto end; } @@ -82,7 +82,7 @@ struct lttng_event *lttng_event_copy(const struct lttng_event *event) end: return new_event; error: - free(event); + free(new_event); goto end; }