pgbackrest.git / summary / log / commit / refs

commit    a7d32259cf00565986d065c93be25dc82bb1a024
Author:   David Steele <david@pgmasters.net>
Date:     Sun Jan 24 13:05:31 2021 +0000

    Avoid NULL pointer arithmetic in MemContext unit test.
    
    Similar to b23a2a0b. In this case add 1 to avoid a NULL pointer.
    
    Found on MacOS M1.


test/src/module/common/memContextTest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/module/common/memContextTest.c b/test/src/module/common/memContextTest.c index f50626005..41e38a3b9 100644 --- a/test/src/module/common/memContextTest.c +++ b/test/src/module/common/memContextTest.c @@ -170,7 +170,7 @@ testRun(void) if (testBegin("memContextAlloc(), memNew*(), memGrow(), and memFree()")) { TEST_RESULT_UINT(sizeof(MemContextAlloc), 8, "check MemContextAlloc size (same for 32/64 bit)"); - TEST_RESULT_PTR(MEM_CONTEXT_ALLOC_BUFFER((void *)0), (void *)sizeof(MemContextAlloc), "check buffer macro"); + TEST_RESULT_PTR(MEM_CONTEXT_ALLOC_BUFFER((void *)1), (void *)(sizeof(MemContextAlloc) + 1), "check buffer macro"); TEST_RESULT_PTR(MEM_CONTEXT_ALLOC_HEADER((void *)sizeof(MemContextAlloc)), (void *)0, "check header macro"); memContextSwitch(memContextTop()); [parent: fe8ef3197e85]