]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Fix mempool-alloconly & mempool-allocfree unit tests
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 27 Nov 2017 13:12:45 +0000 (15:12 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 27 Nov 2017 17:37:10 +0000 (19:37 +0200)
The "physically impossible size" test was supposed to test calloc()==NULL
failure, but in reality it was triggering asserts before that.

src/lib/test-mempool-allocfree.c
src/lib/test-mempool-alloconly.c

index 9a5e179f946737daf24cc9f27daf2b0acad19e06..ab1e664390a786fd1ff7dc69bcd6aa529037db27 100644 (file)
@@ -113,7 +113,7 @@ enum fatal_test_state fatal_mempool_allocfree(unsigned int stage)
                return FATAL_TEST_FAILURE;
 
        case 2: /* physically impossible size */
-               (void)p_malloc(pool, SSIZE_T_MAX - (size_t)MEM_ALIGN(1));
+               (void)p_malloc(pool, SSIZE_T_MAX - 1024);
                return FATAL_TEST_FAILURE;
 
        /* Continue with other tests as follows:
index 5ecd79ca710c89f96d7105f9ef240498577af8c3..1f2094db18067b3b6dc25c659ffa9d59d53025e6 100644 (file)
@@ -72,7 +72,7 @@ enum fatal_test_state fatal_mempool_alloconly(unsigned int stage)
                return FATAL_TEST_FAILURE;
 
        case 2: /* physically impossible size */
-               (void)p_malloc(pool, SSIZE_T_MAX - (size_t)MEM_ALIGN(1));
+               (void)p_malloc(pool, SSIZE_T_MAX - 1024);
                return FATAL_TEST_FAILURE;
 
        /* Continue with other tests as follows: