Fix to support using memory callbacks with no malloc / free using WOLFSSL_NO_MALLOC. Fix to only include <errno.h> if LWIP_PROVIDE_ERRNO is not defined.

This commit is contained in:
David Garske
2018-02-15 06:54:14 -08:00
parent ad1fc26d4e
commit 8285648e46
2 changed files with 9 additions and 1 deletions

View File

@@ -101,7 +101,11 @@ void* wolfSSL_Malloc(size_t size)
#endif #endif
} }
else { else {
#ifndef WOLFSSL_NO_MALLOC
res = malloc(size); res = malloc(size);
#else
WOLFSSL_MSG("No malloc available");
#endif
} }
#ifdef WOLFSSL_MALLOC_CHECK #ifdef WOLFSSL_MALLOC_CHECK
@@ -126,7 +130,11 @@ void wolfSSL_Free(void *ptr)
#endif #endif
} }
else { else {
#ifndef WOLFSSL_NO_MALLOC
free(ptr); free(ptr);
#else
WOLFSSL_MSG("No free available");
#endif
} }
} }

View File

@@ -53,8 +53,8 @@
/* lwIP needs to be configured to use sockets API in this mode */ /* lwIP needs to be configured to use sockets API in this mode */
/* LWIP_SOCKET 1 in lwip/opt.h or in build */ /* LWIP_SOCKET 1 in lwip/opt.h or in build */
#include "lwip/sockets.h" #include "lwip/sockets.h"
#include <errno.h>
#ifndef LWIP_PROVIDE_ERRNO #ifndef LWIP_PROVIDE_ERRNO
#include <errno.h>
#define LWIP_PROVIDE_ERRNO 1 #define LWIP_PROVIDE_ERRNO 1
#endif #endif
#elif defined(FREESCALE_MQX) #elif defined(FREESCALE_MQX)