Progress towards parsing update messages.
[trust_router.git] / trp / msgtst.c
index 83f5476..9b844ff 100644 (file)
@@ -3,6 +3,8 @@
 /* compiles with: gcc -o msgtst -I../include msgtst.c trp_msg.c $(pkg-config --cflags --libs glib-2.0) ../common/tr_debug.c  -ltalloc -ljansson */
 
 #include <stdio.h>
+#include <talloc.h>
+
 #include <trp_internal.h>
 #include <tr_debug.h>
 
@@ -10,6 +12,7 @@
 
 int main(int argc, const char *argv[])
 {
+  TALLOC_CTX *main_ctx=talloc_new(NULL);
   FILE *f;
   char *buf;
   size_t buflen;
@@ -44,8 +47,9 @@ int main(int argc, const char *argv[])
   if (buflen>=MAX_MSG_LEN)
     printf("Warning: file may exceed maximum message length (%d bytes).\n", MAX_MSG_LEN);
 
-  rc=trp_parse_msg(NULL, buf, buflen, &msg);
+  rc=trp_parse_msg(main_ctx, buf, buflen, &msg);
   printf("trp_parse_msg returned %d\n\n", rc);
 
+  talloc_report_full(main_ctx, stderr);
   return 0;
 }