- parsers = talloc_realloc(NULL, parsers, struct parser *, n_parsers + 1);
- parsers[n_parsers] = parser;
- n_parsers++;
+ struct p_item *i;
+
+ if (!parsers_ctx)
+ parsers_ctx = talloc_new(NULL);
+
+ i = talloc(parsers_ctx, struct p_item);
+ i->parser = parser;
+ list_add(&parsers, &i->list);
+}
+
+static __attribute__((destructor)) void cleanup_parsers(void)
+{
+ talloc_free(parsers_ctx);