From d38aff03e1a545fb4d4da15214837a150290f4a8 Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 29 May 2017 18:34:45 +0000 Subject: [PATCH] lib/libnv/tests/dnv_test: fix memory leaks for memory allocated via either strdup or one of the dnvlist* libcalls. Reported by: Coverity CID: 1362056-1362060 Sponsored by: Dell EMC Isilon --- lib/libnv/tests/dnv_tests.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/libnv/tests/dnv_tests.cc b/lib/libnv/tests/dnv_tests.cc index a21a91dfa187..d0fe2597834e 100644 --- a/lib/libnv/tests/dnv_tests.cc +++ b/lib/libnv/tests/dnv_tests.cc @@ -391,6 +391,7 @@ ATF_TEST_CASE_BODY(dnvlist_take_string__empty) ATF_REQUIRE_EQ(strcmp(actual_val, default_val), 0); free(actual_val); + free(default_val); nvlist_destroy(nvl); } @@ -408,6 +409,7 @@ ATF_TEST_CASE_BODY(dnvlist_take_string__default_value) ATF_REQUIRE_EQ(strcmp(actual_val, default_val), 0); free(actual_val); + free(default_val); nvlist_destroy(nvl); } @@ -496,6 +498,7 @@ ATF_TEST_CASE_BODY(dnvlist_take_binary__present) free(actual_val); free(default_val); + free(value); nvlist_destroy(nvl); } @@ -515,6 +518,7 @@ ATF_TEST_CASE_BODY(dnvlist_take_binary__empty) ATF_REQUIRE_EQ(memcmp(actual_val, default_val, actual_size), 0); free(actual_val); + free(default_val); nvlist_destroy(nvl); } @@ -535,6 +539,7 @@ ATF_TEST_CASE_BODY(dnvlist_take_binary__default_value) ATF_REQUIRE_EQ(memcmp(actual_val, default_val, default_size), 0); free(actual_val); + free(default_val); nvlist_destroy(nvl); }