forked from wolfSSL/wolfssl
Support HAVE_SESSION_TICKET without realloc
This commit is contained in:
10
src/ssl.c
10
src/ssl.c
@ -21497,11 +21497,21 @@ static int wolfSSL_DupSessionEx(const WOLFSSL_SESSION* input,
|
|||||||
ret = WOLFSSL_FAILURE;
|
ret = WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
#ifdef WOLFSSL_NO_REALLOC
|
||||||
|
tmp = (byte*)XMALLOC(input->ticketLen,
|
||||||
|
output->heap, DYNAMIC_TYPE_SESSION_TICK);
|
||||||
|
XFREE(ticBuff, output->heap, DYNAMIC_TYPE_SESSION_TICK);
|
||||||
|
ticBuff = NULL;
|
||||||
|
#else
|
||||||
tmp = (byte*)XREALLOC(ticBuff, input->ticketLen,
|
tmp = (byte*)XREALLOC(ticBuff, input->ticketLen,
|
||||||
output->heap, DYNAMIC_TYPE_SESSION_TICK);
|
output->heap, DYNAMIC_TYPE_SESSION_TICK);
|
||||||
|
#endif /* WOLFSSL_NO_REALLOC */
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
WOLFSSL_MSG("Failed to allocate memory for ticket");
|
WOLFSSL_MSG("Failed to allocate memory for ticket");
|
||||||
|
#ifndef WOLFSSL_NO_REALLOC
|
||||||
XFREE(ticBuff, output->heap, DYNAMIC_TYPE_SESSION_TICK);
|
XFREE(ticBuff, output->heap, DYNAMIC_TYPE_SESSION_TICK);
|
||||||
|
ticBuff = NULL;
|
||||||
|
#endif /* WOLFSSL_NO_REALLOC */
|
||||||
output->ticket = NULL;
|
output->ticket = NULL;
|
||||||
output->ticketLen = 0;
|
output->ticketLen = 0;
|
||||||
output->ticketLenAlloc = 0;
|
output->ticketLenAlloc = 0;
|
||||||
|
@ -13603,10 +13603,10 @@ WOLFSSL_TEST_SUBROUTINE int memory_test(void)
|
|||||||
#if !defined(USE_FAST_MATH) && !defined(WOLFSSL_NO_MALLOC) && defined(XREALLOC)
|
#if !defined(USE_FAST_MATH) && !defined(WOLFSSL_NO_MALLOC) && defined(XREALLOC)
|
||||||
/* realloc test */
|
/* realloc test */
|
||||||
{
|
{
|
||||||
byte *c = NULL;
|
|
||||||
byte *b = (byte*)XMALLOC(MEM_TEST_SZ, HEAP_HINT,
|
byte *b = (byte*)XMALLOC(MEM_TEST_SZ, HEAP_HINT,
|
||||||
DYNAMIC_TYPE_TMP_BUFFER);
|
DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
#ifndef WOLFSSL_NO_REALLOC
|
#ifndef WOLFSSL_NO_REALLOC
|
||||||
|
byte *c = NULL;
|
||||||
if (b) {
|
if (b) {
|
||||||
c = (byte*)XREALLOC(b, MEM_TEST_SZ+sizeof(word32), HEAP_HINT,
|
c = (byte*)XREALLOC(b, MEM_TEST_SZ+sizeof(word32), HEAP_HINT,
|
||||||
DYNAMIC_TYPE_TMP_BUFFER);
|
DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
|
Reference in New Issue
Block a user