From 61d789916f2815392028e676b66729d1156a3bc8 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Thu, 8 Oct 2015 09:56:48 -0700 Subject: [PATCH] [master] silence coverity warnings --- lib/dns/tests/dnstest.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/dns/tests/dnstest.c b/lib/dns/tests/dnstest.c index 370a60f7a3..c4346b6958 100644 --- a/lib/dns/tests/dnstest.c +++ b/lib/dns/tests/dnstest.c @@ -367,7 +367,7 @@ dns_test_getdata(const char *file, unsigned char *buf, char *rp, *wp; char s[BUFSIZ]; size_t len, i; - FILE *f; + FILE *f = NULL; int n; result = isc_stdio_open(file, "r", &f); @@ -392,9 +392,9 @@ dns_test_getdata(const char *file, unsigned char *buf, if (len == 0U) continue; if (len % 2 != 0U) - return (ISC_R_UNEXPECTEDEND); + CHECK(ISC_R_UNEXPECTEDEND); if (len > bufsiz * 2) - return (ISC_R_NOSPACE); + CHECK(ISC_R_NOSPACE); rp = s; for (i = 0; i < len; i += 2) { n = fromhex(*rp++); @@ -404,10 +404,14 @@ dns_test_getdata(const char *file, unsigned char *buf, } } - isc_stdio_close(f); *sizep = bp - buf; - return (ISC_R_SUCCESS); + result = ISC_R_SUCCESS; + + cleanup: + if (f != NULL) + isc_stdio_close(f); + return (result); }