Skip to content

Commit

Permalink
vcardparser.c - use icalmemory_free_buffer in _parse_prop_value
Browse files Browse the repository at this point in the history
Fix a bad free() call, where icalmemory_free_buffer() is required
since the memory is allocated with icalmemory_new_buffer().
  • Loading branch information
winterz authored and ksmurchison committed Apr 22, 2024
1 parent 2d508f3 commit b64bea4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libicalvcard/vcardparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,11 +710,11 @@ static int _parse_prop_value(struct vcardparser_state *state)
case ';':
if (is_structured || (is_multivalued && strchr(text_sep, *state->p))) {
const char *str = buf_cstring(&state->buf);
char *dequot_str =
vcardvalue_strdup_and_dequote_text(&str, text_sep);
char *dequot_str = vcardvalue_strdup_and_dequote_text(&str, text_sep);

vcardstrarray_append(textlist, dequot_str);
buf_reset(&state->buf);
free(dequot_str);
icalmemory_free_buffer(dequot_str);

if (*state->p == ';' && is_structured) {
textlist = vcardstrarray_new(2);
Expand Down Expand Up @@ -743,7 +743,7 @@ static int _parse_prop_value(struct vcardparser_state *state)
vcardvalue_strdup_and_dequote_text(&str, text_sep);
vcardstrarray_append(textlist, dequot_str);
buf_reset(&state->buf);
free(dequot_str);
icalmemory_free_buffer(dequot_str);

if (is_structured)
value = vcardvalue_new_structured(&structured);
Expand Down

0 comments on commit b64bea4

Please sign in to comment.