Skip to content

Commit

Permalink
in_process_exporter_metrics: release str in error cases
Browse files Browse the repository at this point in the history
Signed-off-by: Takahiro Yamashita <[email protected]>
  • Loading branch information
nokute78 committed Nov 11, 2023
1 parent 281aea0 commit fb9c353
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 fb9c353

Please sign in to comment.