Fix: common: local_attr might leak
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 1 Mar 2022 15:27:37 +0000 (10:27 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 1 Mar 2022 19:12:27 +0000 (14:12 -0500)
Reported by Coverity:

    CID 1475808: Resource leak (RESOURCE_LEAK)
    Variable local_attr going out of scope leaks the storage it points to.

    CID 1475810: Resource leak (RESOURCE_LEAK)
    Variable local_attr going out of scope leaks the storage it points to.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ibe2ee6516618827b6f52676d9a9f7d510cadf1bc

src/common/event.cpp

index 6d82504e2fe71611be5c86a1aea8b03cbb301c4a..9525d7132fa9d80e81b5e46f598fb81aef3265fa 100644 (file)
@@ -200,6 +200,7 @@ static ssize_t lttng_event_probe_attr_create_from_payload(
        local_attr = NULL;
        ret = offset;
 end:
+       free(local_attr);
        return ret;
 }
 
@@ -261,6 +262,7 @@ static ssize_t lttng_event_function_attr_create_from_payload(
        local_attr = NULL;
        ret = offset;
 end:
+       free(local_attr);
        return ret;
 }
 
This page took 0.026973 seconds and 5 git commands to generate.