diff --git a/wolfssl/test.h b/wolfssl/test.h index b09c632d8..ebe722432 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -1374,7 +1374,7 @@ typedef THREAD_RETURN WOLFSSL_THREAD (*thread_func)(void* args); static INLINE void StackSizeCheck(func_args* args, thread_func tf) { int ret, i, used; - unsigned char* myStack; + unsigned char* myStack = NULL; int stackSize = 1024*128; pthread_attr_t myAttr; pthread_t threadId; @@ -1388,7 +1388,10 @@ static INLINE void StackSizeCheck(func_args* args, thread_func tf) if (ret != 0) err_sys("posix_memalign failed\n"); - memset(myStack, 0x01, stackSize); + XMEMSET(myStack, 0x01, stackSize); + + if (myStack == NULL) + err_sys("Failed to initialize myStack"); ret = pthread_attr_init(&myAttr); if (ret != 0)