In tests/util.c, we should use assert_non_null to ensure malloc() returns non-null pointer in both test_strlcpy_5 and test_strlcpy_6 func.
Signed-off-by: Zhiqiang Liu <liuzhiqian...@huawei.com> Signed-off-by: lixiaokeng <lixiaok...@huawei.com> Signed-off-by: Linfeilong <linfeil...@huawei.com> --- tests/util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/util.c b/tests/util.c index 16774dff..455eeee5 100644 --- a/tests/util.c +++ b/tests/util.c @@ -523,6 +523,7 @@ static void test_strlcpy_5(void **state) const int sz = sizeof(src_str); tst = malloc(sz); + assert_non_null(tst); memset(tst, 'f', sizeof(src_str)); rc = strlcpy(tst, src_str, sz); @@ -540,6 +541,7 @@ static void test_strlcpy_6(void **state) const int sz = sizeof(src_str); tst = malloc(sz + 2); + assert_non_null(tst); memset(tst, 'f', sz + 2); rc = strlcpy(tst, src_str, sz + 2); -- -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel