[PATCH 17/42] malloctest/init.c: Fix use uninitialized warning

Joel Sherrill joel.sherrill at oarcorp.com
Mon Mar 23 14:39:15 UTC 2015


---
 testsuites/libtests/malloctest/init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testsuites/libtests/malloctest/init.c b/testsuites/libtests/malloctest/init.c
index 399cdd5..7e1728d 100644
--- a/testsuites/libtests/malloctest/init.c
+++ b/testsuites/libtests/malloctest/init.c
@@ -1199,6 +1199,9 @@ static void test_posix_memalign(void)
   maximumShift = (sizeof(size_t) * CHAR_BIT) - 1;
   for ( i=sizeof(void *) ; i<maximumShift ; i++ ) {
     size_t alignment = 1 << i;
+
+    p1 = NULL; /* Initialize p1 to aovid used uninitialized */
+
     printf( "posix_memalign - alignment of %zd -- OK\n", alignment);
     sc = posix_memalign( &p1, alignment, 8 );
     if ( sc == ENOMEM ) {
-- 
1.9.3




More information about the devel mailing list