Skip to content

Commit fdc8b38

Browse files
committed
Fix nullAlloc() in tests
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent fb7ec72 commit fdc8b38

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/common/provider_null.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,18 @@ static umf_result_t nullAlloc(void *provider, size_t size, size_t alignment,
2424
(void)provider;
2525
(void)size;
2626
(void)alignment;
27-
*ptr = NULL;
27+
28+
if (ptr == NULL) {
29+
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
30+
}
31+
32+
if (size == 0) {
33+
*ptr = NULL;
34+
return UMF_RESULT_SUCCESS;
35+
}
36+
37+
*ptr = (void *)(uintptr_t)0xDEADBEAF; // any not-NULL value
38+
2839
return UMF_RESULT_SUCCESS;
2940
}
3041

0 commit comments

Comments
 (0)