Unverified Commit 3bfe90dc authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!14504 apparmor: test: Fix memory leak for aa_unpack_strdup()

parents d25c48fd f41d2ead
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -281,6 +281,8 @@ static void policy_unpack_test_unpack_strdup_with_null_name(struct kunit *test)
			   ((uintptr_t)puf->e->start <= (uintptr_t)string)
			   && ((uintptr_t)string <= (uintptr_t)puf->e->end));
	KUNIT_EXPECT_STREQ(test, string, TEST_STRING_DATA);

	kfree(string);
}

static void policy_unpack_test_unpack_strdup_with_name(struct kunit *test)
@@ -296,6 +298,8 @@ static void policy_unpack_test_unpack_strdup_with_name(struct kunit *test)
			   ((uintptr_t)puf->e->start <= (uintptr_t)string)
			   && ((uintptr_t)string <= (uintptr_t)puf->e->end));
	KUNIT_EXPECT_STREQ(test, string, TEST_STRING_DATA);

	kfree(string);
}

static void policy_unpack_test_unpack_strdup_out_of_bounds(struct kunit *test)
@@ -313,6 +317,8 @@ static void policy_unpack_test_unpack_strdup_out_of_bounds(struct kunit *test)
	KUNIT_EXPECT_EQ(test, size, 0);
	KUNIT_EXPECT_NULL(test, string);
	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, start);

	kfree(string);
}

static void policy_unpack_test_unpack_nameX_with_null_name(struct kunit *test)