X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=test%2Furls%2Fparse-url.c;h=6637867c50497b5ff668a60194a02033080d0703;hp=1688eab9540a5f1331bbed76c47cdbab554b11bb;hb=485680a5bfeb952fd652a59efcce35636d6aec00;hpb=307b4b091e0bc298964e90888bf179431e32c134;ds=inline diff --git a/test/urls/parse-url.c b/test/urls/parse-url.c index 1688eab..6637867 100644 --- a/test/urls/parse-url.c +++ b/test/urls/parse-url.c @@ -2,19 +2,23 @@ #include #include +#include #include #include int main(int argc, char **argv) { struct pb_url *url; + void *ctx; if (argc != 2 && argc != 3) { fprintf(stderr, "Usage: %s [update]\n", argv[0]); return EXIT_FAILURE; } - url = pb_url_parse(NULL, argv[1]); + ctx = talloc_new(NULL); + + url = pb_url_parse(ctx, argv[1]); if (!url) return EXIT_FAILURE; @@ -22,8 +26,11 @@ int main(int argc, char **argv) printf("%s\n", argv[1]); } else { + struct pb_url *new_url; printf("%s %s\n", argv[1], argv[2]); - url = pb_url_join(NULL, url, argv[2]); + new_url = pb_url_join(ctx, url, argv[2]); + talloc_free(url); + url = new_url; } printf("scheme\t%s\n", pb_url_scheme_name(url->scheme)); @@ -33,5 +40,7 @@ int main(int argc, char **argv) printf("dir\t%s\n", url->dir); printf("file\t%s\n", url->file); + talloc_free(ctx); + return EXIT_SUCCESS; }