switch vty implementation over to talloc
diff --git a/openbsc/src/vty/buffer.c b/openbsc/src/vty/buffer.c
index 6366100..be6623d 100644
--- a/openbsc/src/vty/buffer.c
+++ b/openbsc/src/vty/buffer.c
@@ -28,9 +28,12 @@
 #include <stddef.h>
 #include <sys/uio.h>
 
+#include <openbsc/talloc.h>
 #include <vty/buffer.h>
 #include <vty/vty.h>
 
+static void *tall_vbuf_ctx;
+
 /* Buffer master. */
 struct buffer {
 	/* Data list. */
@@ -61,14 +64,14 @@
    next page boundery. */
 #define BUFFER_SIZE_DEFAULT		4096
 
-#define BUFFER_DATA_FREE(D) free((D))
+#define BUFFER_DATA_FREE(D) talloc_free((D))
 
 /* Make new buffer. */
 struct buffer *buffer_new(size_t size)
 {
 	struct buffer *b;
 
-	b = calloc(1, sizeof(struct buffer));
+	b = talloc_zero(tall_vbuf_ctx, struct buffer);
 
 	if (size)
 		b->size = size;
@@ -89,7 +92,7 @@
 void buffer_free(struct buffer *b)
 {
 	buffer_reset(b);
-	free(b);
+	talloc_free(b);
 }
 
 /* Make string clone. */
@@ -102,7 +105,7 @@
 
 	for (data = b->head; data; data = data->next)
 		totlen += data->cp - data->sp;
-	if (!(s = malloc(totlen + 1)))
+	if (!(s = _talloc_zero(tall_vbuf_ctx, (totlen + 1), "buffer_getstr")))
 		return NULL;
 	p = s;
 	for (data = b->head; data; data = data->next) {
@@ -137,7 +140,9 @@
 {
 	struct buffer_data *d;
 
-	d = malloc(offsetof(struct buffer_data, data[b->size]));
+	d = _talloc_zero(tall_vbuf_ctx,
+			 offsetof(struct buffer_data, data[b->size]),
+			 "buffer_add");
 	if (!d)
 		return NULL;
 	d->cp = d->sp = 0;
@@ -458,3 +463,8 @@
 	}
 	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");
+}