diff options
author | 2019-11-06 07:19:45 +0000 | |
---|---|---|
committer | 2019-11-06 07:19:45 +0000 | |
commit | 93a84cc2fdb73db01db51e868c6e456abf7642d0 (patch) | |
tree | 759eaadfd45004abc3935e00f0adb733158613d9 | |
parent | If tal_parse_buffer() fails return early because the code that follows (diff) | |
download | wireguard-openbsd-93a84cc2fdb73db01db51e868c6e456abf7642d0.tar.xz wireguard-openbsd-93a84cc2fdb73db01db51e868c6e456abf7642d0.zip |
Cleanup code a bit, make sure the tal parse buffer is allways freed.
-rw-r--r-- | regress/usr.sbin/rpki-client/test-tal.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/regress/usr.sbin/rpki-client/test-tal.c b/regress/usr.sbin/rpki-client/test-tal.c index e2069bd6f38..35a70d24725 100644 --- a/regress/usr.sbin/rpki-client/test-tal.c +++ b/regress/usr.sbin/rpki-client/test-tal.c @@ -1,4 +1,4 @@ -/* $Id: test-tal.c,v 1.4 2019/11/04 09:40:39 claudio Exp $ */ +/* $Id: test-tal.c,v 1.5 2019/11/06 07:19:45 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -53,7 +53,7 @@ main(int argc, char *argv[]) OpenSSL_add_all_ciphers(); OpenSSL_add_all_digests(); - while (-1 != (c = getopt(argc, argv, "v"))) + while ((c = getopt(argc, argv, "v")) != -1) switch (c) { case 'v': verb++; @@ -70,9 +70,10 @@ main(int argc, char *argv[]) for (i = 0; i < argc; i++) { buf = tal_read_file(argv[i]); - if ((tal = tal_parse(argv[i], buf)) == NULL) - break; + tal = tal_parse(argv[i], buf); free(buf); + if (tal == NULL) + break; if (verb) tal_print(tal); tal_free(tal); |