Skip to content

Commit

Permalink
in_process_exporter_metrics: release str in error cases (#8163)
Browse files Browse the repository at this point in the history
Signed-off-by: Takahiro Yamashita <[email protected]>
  • Loading branch information
nokute78 authored Dec 19, 2023
1 parent a8e2270 commit ee36c60
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/in_process_exporter_metrics/pe_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit ee36c60

Please sign in to comment.