int bind_mount_add(BindMount **b, size_t *n, const BindMount *item) {
_cleanup_free_ char *s = NULL, *d = NULL;
- BindMount *c;
assert(b);
assert(n);
if (!d)
return -ENOMEM;
- c = reallocarray(*b, *n + 1, sizeof(BindMount));
- if (!c)
+ if (!GREEDY_REALLOC(*b, *n + 1))
return -ENOMEM;
- *b = c;
-
- c[(*n)++] = (BindMount) {
+ (*b)[(*n)++] = (BindMount) {
.source = TAKE_PTR(s),
.destination = TAKE_PTR(d),
.read_only = item->read_only,