Skip to content

Commit

Permalink
lib/ec_glob: plug leak of nums utarray
Browse files Browse the repository at this point in the history
  • Loading branch information
chergert committed Jun 12, 2024
1 parent cfb7efd commit ca14e15
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lib/ec_glob.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,20 @@ static const UT_icd ut_int_pair_icd = {sizeof(int_pair),NULL,NULL,NULL};
#define STRING_CAT(p, string, end) do { \
size_t string_len = strlen(string); \
assert(end > p); \
if (string_len >= (size_t)(end - p)) \
if (string_len >= (size_t)(end - p)) { \
utarray_free(nums); \
return -1; \
} \
strcat(p, string); \
p += string_len; \
} while(0)

/* safely add a char to a string then move the pointer to the end */
#define ADD_CHAR(string, new_chr, end) do { \
if (string + 1 >= end) \
if (string + 1 >= end) { \
utarray_free(nums); \
return -1; \
} \
*(string ++) = new_chr; \
} while(0)

Expand Down

0 comments on commit ca14e15

Please sign in to comment.