[vty] Move some allocations into the context of the vty.
diff --git a/openbsc/src/vty/vty.c b/openbsc/src/vty/vty.c
index 66e7d05..8455b0e 100644
--- a/openbsc/src/vty/vty.c
+++ b/openbsc/src/vty/vty.c
@@ -54,7 +54,7 @@
new->obuf = buffer_new(0); /* Use default buffer size. */
if (!new->obuf)
goto out_new;
- new->buf = _talloc_zero(tall_vty_ctx, VTY_BUFSIZ, "vty_new->buf");
+ new->buf = _talloc_zero(new, VTY_BUFSIZ, "vty_new->buf");
if (!new->buf)
goto out_obuf;
@@ -210,7 +210,7 @@
else
size = size * 2;
- p = talloc_realloc_size(tall_vty_ctx, p, size);
+ p = talloc_realloc_size(vty, p, size);
if (!p)
return -1;
@@ -357,7 +357,7 @@
{
if (vty->max <= length) {
vty->max *= 2;
- vty->buf = talloc_realloc_size(tall_vty_ctx, vty->buf, vty->max);
+ vty->buf = talloc_realloc_size(vty, vty->buf, vty->max);
// FIXME: check return
}
}
@@ -458,7 +458,7 @@
/* Insert history entry. */
if (vty->hist[vty->hindex])
talloc_free(vty->hist[vty->hindex]);
- vty->hist[vty->hindex] = talloc_strdup(tall_vty_ctx, vty->buf);
+ vty->hist[vty->hindex] = talloc_strdup(vty, vty->buf);
/* History index rotation. */
vty->hindex++;
@@ -965,7 +965,7 @@
return;
}
- buf = _talloc_zero(tall_vty_ctx, strlen(desc->str) + 1, "describe_fold");
+ buf = _talloc_zero(vty, strlen(desc->str) + 1, "describe_fold");
if (!buf)
return;