From ee36c60bc8e76fd27de90bcf22afc0a56ec18cf8 Mon Sep 17 00:00:00 2001 From: Takahiro Yamashita Date: Wed, 20 Dec 2023 04:30:54 +0900 Subject: [PATCH] in_process_exporter_metrics: release str in error cases (#8163) Signed-off-by: Takahiro Yamashita --- plugins/in_process_exporter_metrics/pe_process.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/in_process_exporter_metrics/pe_process.c b/plugins/in_process_exporter_metrics/pe_process.c index fdfb787eb35..529971cda4d 100644 --- a/plugins/in_process_exporter_metrics/pe_process.c +++ b/plugins/in_process_exporter_metrics/pe_process.c @@ -309,6 +309,7 @@ static int get_name(const char *entry, char **out_name, char *id_entry) tmp = strdup(entry); tmp_name = strtok(tmp, ")"); if (tmp_name == NULL) { + flb_free(tmp); return -1; } @@ -538,12 +539,14 @@ static int process_thread_update(struct flb_pe *ctx, uint64_t ts, flb_sds_t pid, * The entry of processes stat will start after that. */ tmp = strstr(entry->str, ")"); if (tmp == NULL) { + flb_free(thread_name); continue; } mk_list_init(&split_list); ret = flb_slist_split_string(&split_list, tmp+2, ' ', -1); if (ret == -1) { + flb_free(thread_name); continue; }