From b6e2633ca8ddaf6912c3cd736f313758317c1de7 Mon Sep 17 00:00:00 2001 From: Mukund Sivaraman Date: Mon, 19 Mar 2018 18:10:41 +0530 Subject: [PATCH] Check return value of isc_mem_get() (cherry picked from commit de3a4af1bf3180beb8a464c0c68ba69c980e51b4) --- lib/dns/tests/rbt_test.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/dns/tests/rbt_test.c b/lib/dns/tests/rbt_test.c index 734238daa1..c38d6783d9 100644 --- a/lib/dns/tests/rbt_test.c +++ b/lib/dns/tests/rbt_test.c @@ -167,11 +167,13 @@ test_context_setup(void) { name = dns_fixedname_name(&fname); n = isc_mem_get(mctx, sizeof(size_t)); + ATF_REQUIRE(n != NULL); *n = i + 1; result = dns_rbt_addname(ctx->rbt, name, n); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); n = isc_mem_get(mctx, sizeof(size_t)); + ATF_REQUIRE(n != NULL); *n = node_distances[i]; result = dns_rbt_addname(ctx->rbt_distances, name, n); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); @@ -364,6 +366,7 @@ ATF_TC_BODY(rbt_check_distance_random, tc) { char namebuf[34]; n = isc_mem_get(mctx, sizeof(size_t)); + ATF_REQUIRE(n != NULL); *n = i + 1; while (1) { @@ -450,6 +453,7 @@ ATF_TC_BODY(rbt_check_distance_ordered, tc) { dns_name_t *name; n = isc_mem_get(mctx, sizeof(size_t)); + ATF_REQUIRE(n != NULL); *n = i + 1; snprintf(namebuf, sizeof(namebuf), "name%08x.", i); @@ -736,6 +740,7 @@ ATF_TC_BODY(rbt_remove, tc) { ATF_REQUIRE_EQ(node->data, NULL); n = isc_mem_get(mctx, sizeof(size_t)); + ATF_REQUIRE(n != NULL); *n = i; node->data = n; @@ -1144,6 +1149,7 @@ ATF_TC_BODY(rbt_addname, tc) { ctx = test_context_setup(); n = isc_mem_get(mctx, sizeof(size_t)); + ATF_REQUIRE(n != NULL); *n = 1; dns_test_namefromstring("d.e.f.g.h.i.j.k", &fname); @@ -1155,6 +1161,7 @@ ATF_TC_BODY(rbt_addname, tc) { /* Now add again, should get ISC_R_EXISTS */ n = isc_mem_get(mctx, sizeof(size_t)); + ATF_REQUIRE(n != NULL); *n = 2; result = dns_rbt_addname(ctx->rbt, name, n); ATF_REQUIRE_EQ(result, ISC_R_EXISTS);