Fix: event copy constructor frees original event on error
[lttng-tools.git] / 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.024452 seconds and 5 git commands to generate.