Skip to content

Commit

Permalink
Merge pull request #14170 from mjstapp/fix_bitfield_mtype
Browse files Browse the repository at this point in the history
libs: use XREALLOC in bitfield lib module
  • Loading branch information
ton31337 authored Aug 10, 2023
2 parents b886422 + 82cde1f commit 4751e9a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/bitfield.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ DECLARE_MTYPE(BITFIELD);
(v).n += ((v).data[w] == WORD_MAX); \
if ((v).n == (v).m) { \
(v).m = (v).m + 1; \
(v).data = realloc((v).data, (v).m * sizeof(word_t)); \
(v).data = XREALLOC(MTYPE_BITFIELD, (v).data, \
(v).m * sizeof(word_t)); \
} \
} while (0)

Expand Down Expand Up @@ -188,7 +189,8 @@ bf_find_next_clear_bit_wrap(bitfield_t *v, word_t start_index, word_t max_index)
* will allocate additional space.
*/
v->m += 1;
v->data = (word_t *)realloc(v->data, v->m * sizeof(word_t));
v->data = (word_t *)XREALLOC(MTYPE_BITFIELD, v->data,
v->m * sizeof(word_t));
v->data[v->m - 1] = 0;
return v->m * WORD_SIZE;
}
Expand Down

0 comments on commit 4751e9a

Please sign in to comment.