Skip to content

Commit

Permalink
decode_statsd: plug a possible resource leak (CID 508657) (#214)
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 authored Aug 19, 2024
1 parent c600f17 commit 6f22893
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/cmt_decode_statsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static int decode_labels(struct cmt *cmt,
size_t label_index;
int label_found;
char *label_kv, *colon;
cfl_sds_t label_k, label_v, tmp;
cfl_sds_t label_k = NULL, label_v = NULL, tmp = NULL;
int result;
struct cfl_list *head = NULL;
struct cfl_list *kvs = NULL;
Expand Down Expand Up @@ -203,10 +203,12 @@ static int decode_labels(struct cmt *cmt,
}

if (result == CMT_DECODE_STATSD_SUCCESS) {
value_index_list[label_index] = (void *) label_v;
value_index_list[label_index] = (void *) cfl_sds_create_len(label_v,
cfl_sds_len(label_v));
}

cfl_sds_destroy(label_k);
cfl_sds_destroy(label_v);
}
}

Expand Down

0 comments on commit 6f22893

Please sign in to comment.