use one talloc context for entire vty code
diff --git a/openbsc/src/vty/buffer.c b/openbsc/src/vty/buffer.c
index be6623d..8ab7311 100644
--- a/openbsc/src/vty/buffer.c
+++ b/openbsc/src/vty/buffer.c
@@ -32,8 +32,6 @@
#include <vty/buffer.h>
#include <vty/vty.h>
-static void *tall_vbuf_ctx;
-
/* Buffer master. */
struct buffer {
/* Data list. */
@@ -71,7 +69,7 @@
{
struct buffer *b;
- b = talloc_zero(tall_vbuf_ctx, struct buffer);
+ b = talloc_zero(tall_vty_ctx, struct buffer);
if (size)
b->size = size;
@@ -105,7 +103,7 @@
for (data = b->head; data; data = data->next)
totlen += data->cp - data->sp;
- if (!(s = _talloc_zero(tall_vbuf_ctx, (totlen + 1), "buffer_getstr")))
+ if (!(s = _talloc_zero(tall_vty_ctx, (totlen + 1), "buffer_getstr")))
return NULL;
p = s;
for (data = b->head; data; data = data->next) {
@@ -140,7 +138,7 @@
{
struct buffer_data *d;
- d = _talloc_zero(tall_vbuf_ctx,
+ d = _talloc_zero(tall_vty_ctx,
offsetof(struct buffer_data, data[b->size]),
"buffer_add");
if (!d)
@@ -463,8 +461,3 @@
}
return b->head ? BUFFER_PENDING : BUFFER_EMPTY;
}
-
-static __attribute__((constructor)) void on_dso_load_vty_buf(void)
-{
- tall_vbuf_ctx = talloc_named_const(NULL, 1, "vty_buffer");
-}