mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 11:08:06 +00:00
Reworked maybe_grow to take a single ptr, renamed to afl_realloc (#505)
* maybe_grow takes a single ptr * fixed use_deflate * reworked maybe_grow_bufsize * helper to access underlying buf * remove redundant realloc_block * code format * fixes * added unit tests * renamed maybe_grow to afl_realloc * BUF_PARAMS -> AFL_BUF_PARAM
This commit is contained in:
@ -152,8 +152,10 @@ void load_extras_file(afl_state_t *afl, u8 *fname, u32 *min_len, u32 *max_len,
|
||||
/* Okay, let's allocate memory and copy data between "...", handling
|
||||
\xNN escaping, \\, and \". */
|
||||
|
||||
afl->extras = ck_realloc_block(
|
||||
afl->extras, (afl->extras_cnt + 1) * sizeof(struct extra_data));
|
||||
afl->extras =
|
||||
afl_realloc((void **)&afl->extras,
|
||||
(afl->extras_cnt + 1) * sizeof(struct extra_data));
|
||||
if (unlikely(!afl->extras)) { PFATAL("alloc"); }
|
||||
|
||||
wptr = afl->extras[afl->extras_cnt].data = ck_alloc(rptr - lptr);
|
||||
|
||||
@ -296,8 +298,10 @@ void load_extras(afl_state_t *afl, u8 *dir) {
|
||||
if (min_len > st.st_size) { min_len = st.st_size; }
|
||||
if (max_len < st.st_size) { max_len = st.st_size; }
|
||||
|
||||
afl->extras = ck_realloc_block(
|
||||
afl->extras, (afl->extras_cnt + 1) * sizeof(struct extra_data));
|
||||
afl->extras =
|
||||
afl_realloc((void **)&afl->extras,
|
||||
(afl->extras_cnt + 1) * sizeof(struct extra_data));
|
||||
if (unlikely(!afl->extras)) { PFATAL("alloc"); }
|
||||
|
||||
afl->extras[afl->extras_cnt].data = ck_alloc(st.st_size);
|
||||
afl->extras[afl->extras_cnt].len = st.st_size;
|
||||
|
Reference in New Issue
Block a user