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");
-}
diff --git a/openbsc/src/vty/command.c b/openbsc/src/vty/command.c
index 9841343..fa21147 100644
--- a/openbsc/src/vty/command.c
+++ b/openbsc/src/vty/command.c
@@ -49,8 +49,6 @@
 #include <openbsc/gsm_subscriber.h>
 #include <openbsc/talloc.h>
 
-static void *tall_vcmd_ctx;
-
 /* Command vector which includes some level of command lists. Normally
    each daemon maintains each own cmdvec. */
 vector cmdvec;
@@ -175,7 +173,7 @@
 		len += strlen(argv[i]) + 1;
 	if (!len)
 		return NULL;
-	p = str = _talloc_zero(tall_vcmd_ctx, len, "arvg_concat");
+	p = str = _talloc_zero(tall_vty_ctx, len, "arvg_concat");
 	for (i = shift; i < argc; i++) {
 		size_t arglen;
 		memcpy(p, argv[i], (arglen = strlen(argv[i])));
@@ -277,7 +275,7 @@
 		       *cp != '\0')
 			cp++;
 		strlen = cp - start;
-		token = _talloc_zero(tall_vcmd_ctx, strlen + 1, "make_strvec");
+		token = _talloc_zero(tall_vty_ctx, strlen + 1, "make_strvec");
 		memcpy(token, start, strlen);
 		*(token + strlen) = '\0';
 		vector_set(strvec, token);
@@ -333,7 +331,7 @@
 		cp++;
 
 	strlen = cp - start;
-	token = _talloc_zero(tall_vcmd_ctx, strlen + 1, "cmd_desc_str");
+	token = _talloc_zero(tall_vty_ctx, strlen + 1, "cmd_desc_str");
 	memcpy(token, start, strlen);
 	*(token + strlen) = '\0';
 
@@ -404,11 +402,11 @@
 
 		len = cp - sp;
 
-		token = _talloc_zero(tall_vcmd_ctx, len + 1, "cmd_make_descvec");
+		token = _talloc_zero(tall_vty_ctx, len + 1, "cmd_make_descvec");
 		memcpy(token, sp, len);
 		*(token + len) = '\0';
 
-		desc = talloc_zero(tall_vcmd_ctx, struct desc);
+		desc = talloc_zero(tall_vty_ctx, struct desc);
 		desc->cmd = token;
 		desc->str = cmd_desc_str(&dp);
 
@@ -1855,7 +1853,7 @@
 			if (len < lcd) {
 				char *lcdstr;
 
-				lcdstr = _talloc_zero(tall_vcmd_ctx, lcd + 1,
+				lcdstr = _talloc_zero(tall_vty_ctx, lcd + 1,
 						      "complete-lcdstr");
 				memcpy(lcdstr, matchvec->index[0], lcd);
 				lcdstr[lcd] = '\0';
@@ -2476,13 +2474,13 @@
 	config_file = host.config;
 
 	config_file_sav =
-	    _talloc_zero(tall_vcmd_ctx,
+	    _talloc_zero(tall_vty_ctx,
 			 strlen(config_file) + strlen(CONF_BACKUP_EXT) + 1,
 			 "config_file_sav");
 	strcpy(config_file_sav, config_file);
 	strcat(config_file_sav, CONF_BACKUP_EXT);
 
-	config_file_tmp = _talloc_zero(tall_vcmd_ctx, strlen(config_file) + 8,
+	config_file_tmp = _talloc_zero(tall_vty_ctx, strlen(config_file) + 8,
 					"config_file_tmp");
 	sprintf(config_file_tmp, "%s.XXXXXX", config_file);
 
@@ -3421,8 +3419,3 @@
 	}
 	srand(time(NULL));
 }
-
-static __attribute__((constructor)) void on_dso_load_vty_command(void)
-{
-	tall_vcmd_ctx = talloc_named_const(NULL, 1, "vty_command");
-}
diff --git a/openbsc/src/vty/vector.c b/openbsc/src/vty/vector.c
index c8885a4..371f71d 100644
--- a/openbsc/src/vty/vector.c
+++ b/openbsc/src/vty/vector.c
@@ -23,15 +23,14 @@
 #include <unistd.h>
 
 #include <vty/vector.h>
+#include <vty/vty.h>
 #include <openbsc/talloc.h>
 #include <memory.h>
 
-static void *tall_vvec_ctx;
-
 /* Initialize vector : allocate memory and return vector. */
 vector vector_init(unsigned int size)
 {
-	vector v = talloc_zero(tall_vvec_ctx, struct _vector);
+	vector v = talloc_zero(tall_vty_ctx, struct _vector);
 	if (!v)
 		return NULL;
 
@@ -41,7 +40,7 @@
 
 	v->alloced = size;
 	v->active = 0;
-	v->index = _talloc_zero(tall_vvec_ctx, sizeof(void *) * size,
+	v->index = _talloc_zero(tall_vty_ctx, sizeof(void *) * size,
 				"vector_init:index");
 	if (!v->index) {
 		talloc_free(v);
@@ -69,7 +68,7 @@
 vector vector_copy(vector v)
 {
 	unsigned int size;
-	vector new = talloc_zero(tall_vvec_ctx, struct _vector);
+	vector new = talloc_zero(tall_vty_ctx, struct _vector);
 	if (!new)
 		return NULL;
 
@@ -77,7 +76,7 @@
 	new->alloced = v->alloced;
 
 	size = sizeof(void *) * (v->alloced);
-	new->index = _talloc_zero(tall_vvec_ctx, size, "vector_copy:index");
+	new->index = _talloc_zero(tall_vty_ctx, size, "vector_copy:index");
 	if (!new->index) {
 		talloc_free(new);
 		return NULL;
@@ -93,7 +92,7 @@
 	if (v->alloced > num)
 		return;
 
-	v->index = talloc_realloc_size(tall_vvec_ctx, v->index,
+	v->index = talloc_realloc_size(tall_vty_ctx, v->index,
 				       sizeof(void *) * (v->alloced * 2));
 	memset(&v->index[v->alloced], 0, sizeof(void *) * v->alloced);
 	v->alloced *= 2;
@@ -189,8 +188,3 @@
 
 	return count;
 }
-
-static __attribute__((constructor)) void on_dso_load_vty_vec(void)
-{
-	tall_vvec_ctx = talloc_named_const(NULL, 1, "vty_vector");
-}
diff --git a/openbsc/src/vty/vty.c b/openbsc/src/vty/vty.c
index 0549914..9962474 100644
--- a/openbsc/src/vty/vty.c
+++ b/openbsc/src/vty/vty.c
@@ -33,7 +33,7 @@
 
 static int no_password_check = 1;
 
-static void *tall_vty_ctx;
+void *tall_vty_ctx;
 
 static void vty_clear_buf(struct vty *vty)
 {
@@ -1616,14 +1616,15 @@
 	vtyvec = vector_init(VECTOR_MIN_SIZE);
 }
 
+extern void *tall_bsc_ctx;
 /* Install vty's own commands like `who' command. */
 void vty_init()
 {
+	tall_vty_ctx = talloc_named_const(tall_bsc_ctx, 1, "vty");
+
 	/* For further configuration read, preserve current directory. */
 	vty_save_cwd();
 
-	host.config = "openbsc.cfg";
-
 	vtyvec = vector_init(VECTOR_MIN_SIZE);
 
 	/* Install bgp top node. */