Skip to content

Commit

Permalink
id: fixed a potential leak when a malformed string is processed
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Alminana <[email protected]>
  • Loading branch information
leonardo-albertovich authored and edsiper committed Feb 9, 2023
1 parent be0ec8e commit c22d413
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ctr_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,12 @@ struct ctrace_id *ctr_id_from_base16(cfl_sds_t id)
input_index++;
}

if (!result) {
return NULL;
if (result) {
result_id = ctr_id_create(decoded_id, length / 2);
}
else {
result_id = NULL;
}

result_id = ctr_id_create(decoded_id, length / 2);

cfl_sds_destroy(decoded_id);

Expand Down

0 comments on commit c22d413

Please sign in to comment.