- if ((*fb)->b.len + padding + len > (*fb)->alloc_len) {
- uint32_t new_len =
- max_t(uint32_t, 1U << get_count_order((*fb)->b.len + padding + len),
- (*fb)->alloc_len << 1);
- uint32_t old_len = (*fb)->alloc_len;
-
- *fb = realloc(*fb, sizeof(struct lttng_filter_bytecode_alloc) + new_len);
+ if (new_alloc_len > old_alloc_len) {
+ new_alloc_len =
+ max_t(uint32_t, 1U << get_count_order(new_alloc_len), old_alloc_len << 1);
+ *fb = realloc(*fb, new_alloc_len);