Skip to content

Commit

Permalink
decode_statsd: Validate return values
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Aug 7, 2024
1 parent 3bdd82a commit 678f42e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 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;
cfl_sds_t label_k, label_v, tmp;
int result;
char *store;

Expand All @@ -125,11 +125,16 @@ static int decode_labels(struct cmt *cmt,

if (incremental) {
label_k = cfl_sds_create("incremental");
result = append_new_map_label_key(map, label_k);
cfl_sds_destroy(label_k);
if (label_k != NULL) {
result = append_new_map_label_key(map, label_k);
cfl_sds_destroy(label_k);

if (result == CMT_DECODE_STATSD_SUCCESS) {
value_index_list[label_index] = (void *) cfl_sds_create("true");
if (result == CMT_DECODE_STATSD_SUCCESS) {
tmp = (void *) cfl_sds_create("true");
if (tmp != NULL) {
value_index_list[label_index] = tmp;
}
}
}
}

Expand Down

0 comments on commit 678f42e

Please sign in to comment.