]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
write_open_telemetry plugin: Fix minor memory leak. 4180/head
authorFlorian Forster <octo@collectd.org>
Wed, 3 Jan 2024 17:39:52 +0000 (18:39 +0100)
committerFlorian Forster <octo@collectd.org>
Wed, 3 Jan 2024 17:39:52 +0000 (18:39 +0100)
Error:

```
==171106== 8 bytes in 1 blocks are definitely lost in loss record 58 of 228
==171106==    at 0x48407B4: malloc (vg_replace_malloc.c:381)
==171106==    by 0x492E7F9: strdup (strdup.c:42)
==171106==    by 0x1131F9: cf_util_get_string (configfile.c:1127)
==171106==    by 0x4EA3FD0: ot_config_node (write_open_telemetry.cc:206)
==171106==    by 0x4EA3FD0: ??? (write_open_telemetry.cc:262)
==171106==    by 0x111794: dispatch_block_plugin (configfile.c:464)
==171106==    by 0x1119B9: dispatch_block (configfile.c:508)
==171106==    by 0x11313D: cf_read (configfile.c:1100)
==171106==    by 0x11034E: configure_collectd (collectd.c:356)
==171106==    by 0x1104B6: init_config (collectd.c:406)
==171106==    by 0x121F3F: main (cmd.c:167)
```

src/write_open_telemetry.cc

index 34096f68d173a149cb8a6349b65e56e21db50fe1..8491724c093e6f50be4652847937f24690694a7e 100644 (file)
@@ -156,6 +156,7 @@ static void ot_callback_decref(void *data) {
 
   cb->stub.reset();
 
+  sfree(cb->name);
   sfree(cb->host);
   sfree(cb->port);