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
This commit is contained in:
ngie 2017-05-29 18:34:45 +00:00
parent 4af7f7589a
commit d38aff03e1

View File

@ -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);
}