Fix: event copy constructor frees original event on error
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 24 Aug 2018 20:32:12 +0000 (16:32 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 24 Aug 2018 20:50:34 +0000 (16:50 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/lib/lttng-ctl/event.c

index 44e4864c02cdb0552663b4a57537df2b3dde75fb..5785345cd1bdb703da157f428da38733aefc582f 100644 (file)
@@ -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;
 }
 
This page took 0.026931 seconds and 5 git commands to generate.