mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-29 18:27:29 +02:00
Merge pull request #6233 from embhorn/gh6209
Support HAVE_SESSION_TICKET without realloc
This commit is contained in:
10
src/ssl.c
10
src/ssl.c
@ -21157,11 +21157,21 @@ static int wolfSSL_DupSessionEx(const WOLFSSL_SESSION* input,
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
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,
|
||||
output->heap, DYNAMIC_TYPE_SESSION_TICK);
|
||||
#endif /* WOLFSSL_NO_REALLOC */
|
||||
if (tmp == NULL) {
|
||||
WOLFSSL_MSG("Failed to allocate memory for ticket");
|
||||
#ifndef WOLFSSL_NO_REALLOC
|
||||
XFREE(ticBuff, output->heap, DYNAMIC_TYPE_SESSION_TICK);
|
||||
ticBuff = NULL;
|
||||
#endif /* WOLFSSL_NO_REALLOC */
|
||||
output->ticket = NULL;
|
||||
output->ticketLen = 0;
|
||||
output->ticketLenAlloc = 0;
|
||||
|
@ -13607,10 +13607,10 @@ WOLFSSL_TEST_SUBROUTINE int memory_test(void)
|
||||
#if !defined(USE_FAST_MATH) && !defined(WOLFSSL_NO_MALLOC) && defined(XREALLOC)
|
||||
/* realloc test */
|
||||
{
|
||||
byte *c = NULL;
|
||||
byte *b = (byte*)XMALLOC(MEM_TEST_SZ, HEAP_HINT,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#ifndef WOLFSSL_NO_REALLOC
|
||||
byte *c = NULL;
|
||||
if (b) {
|
||||
c = (byte*)XREALLOC(b, MEM_TEST_SZ+sizeof(word32), HEAP_HINT,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
Reference in New Issue
Block a user