diff --git a/src/lib/ec_glob.c b/src/lib/ec_glob.c index c2b83cf..9bfaf9e 100644 --- a/src/lib/ec_glob.c +++ b/src/lib/ec_glob.c @@ -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)