Skip to content

Commit

Permalink
wolfssl/wolfcrypt/types.h: add needed (void)s for unused args to seve…
Browse files Browse the repository at this point in the history
…ral XMALLOC/XFREE/XREALLOC macros that were missing them.

src/quic.c: fix misspelled DYNAMIC_TYPE_TMP_BUFFER.
  • Loading branch information
douzzer committed Nov 29, 2023
1 parent 93ab397 commit 73ca6da
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/quic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ size_t wolfSSL_quic_get_aead_tag_len(const WOLFSSL_EVP_CIPHER* aead_cipher)
}

#ifdef WOLFSSL_SMALL_STACK
XFREE(ctx, NULL, DYNAMIC_TYPE_TMP_BUF);
XFREE(ctx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
#endif

return ret;
Expand Down
46 changes: 23 additions & 23 deletions wolfssl/wolfcrypt/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ typedef struct w64wrapper {
#elif defined(WOLFSSL_TELIT_M2MB)
/* Telit M2MB SDK requires use m2mb_os API's, not std malloc/free */
/* Use of malloc/free will cause CPU reboot */
#define XMALLOC(s, h, t) ((void)h, (void)t, m2mb_os_malloc((s)))
#define XMALLOC(s, h, t) ((void)(h), (void)(t), m2mb_os_malloc((s)))
#ifdef WOLFSSL_XFREE_NO_NULLNESS_CHECK
#define XFREE(p, h, t) m2mb_os_free(xp)
#else
Expand All @@ -505,25 +505,25 @@ typedef struct w64wrapper {
fprintf(stderr, "wolfSSL_malloc failed");
return NULL;
};
#define XMALLOC(s, h, t) malloc_check((s))
#define XFREE(p, h, t) WC_DO_NOTHING
#define XREALLOC(p, n, h, t) (NULL)
#define XMALLOC(s, h, t) ((void)(h), (void)(t), malloc_check((s)))
#define XFREE(p, h, t) (void)(h); (void)(t)
#define XREALLOC(p, n, h, t) ((void)(h), (void)(t), NULL)
#else
#define XMALLOC(s, h, t) (NULL)
#define XFREE(p, h, t) WC_DO_NOTHING
#define XREALLOC(p, n, h, t) (NULL)
#define XMALLOC(s, h, t) ((void)(s), (void)(h), (void)(t), NULL)
#define XFREE(p, h, t) (void)(p); (void)(h); (void)(t)
#define XREALLOC(p, n, h, t) ((void)(p), (void)(n), (void)(h), (void)(t), NULL)
#endif
#else
/* just use plain C stdlib stuff if desired */
#include <stdlib.h>
#define XMALLOC(s, h, t) ((void)(h), (void)(t), malloc((size_t)(s)))
#ifdef WOLFSSL_XFREE_NO_NULLNESS_CHECK
#define XFREE(p, h, t) ((void)(h), (void)(t), free(p))
#else
#define XFREE(p, h, t) {void* xp = (p); if (xp) free(xp);}
#endif
#define XREALLOC(p, n, h, t) \
((void)(h), (void)(t), realloc((p), (size_t)(n)))
/* just use plain C stdlib stuff if desired */
#include <stdlib.h>
#define XMALLOC(s, h, t) ((void)(h), (void)(t), malloc((size_t)(s)))
#ifdef WOLFSSL_XFREE_NO_NULLNESS_CHECK
#define XFREE(p, h, t) ((void)(h), (void)(t), free(p))
#else
#define XFREE(p, h, t) {void* xp = (p); (void)(h); if (xp) free(xp);}
#endif
#define XREALLOC(p, n, h, t) \
((void)(h), (void)(t), realloc((p), (size_t)(n)))
#endif

#elif defined(WOLFSSL_LINUXKM)
Expand Down Expand Up @@ -560,19 +560,19 @@ typedef struct w64wrapper {
#ifdef WOLFSSL_DEBUG_MEMORY
#define XMALLOC(s, h, t) ((void)(h), (void)(t), wolfSSL_Malloc((s), __func__, __LINE__))
#ifdef WOLFSSL_XFREE_NO_NULLNESS_CHECK
#define XFREE(p, h, t) wolfSSL_Free(xp, __func__, __LINE__)
#define XFREE(p, h, t) ((void)(h), (void)(t), wolfSSL_Free(xp, __func__, __LINE__))
#else
#define XFREE(p, h, t) {void* xp = (p); if (xp) wolfSSL_Free(xp, __func__, __LINE__);}
#define XFREE(p, h, t) {void* xp = (p); (void)(h); (void)(t); if (xp) wolfSSL_Free(xp, __func__, __LINE__);}
#endif
#define XREALLOC(p, n, h, t) wolfSSL_Realloc((p), (n), __func__, __LINE__)
#define XREALLOC(p, n, h, t) ((void)(h), (void)(t), wolfSSL_Realloc((p), (n), __func__, __LINE__))
#else
#define XMALLOC(s, h, t) ((void)(h), (void)(t), wolfSSL_Malloc((s)))
#ifdef WOLFSSL_XFREE_NO_NULLNESS_CHECK
#define XFREE(p, h, t) wolfSSL_Free(p)
#define XFREE(p, h, t) ((void)(h), (void)(t), wolfSSL_Free(p))
#else
#define XFREE(p, h, t) {void* xp = (p); if (xp) wolfSSL_Free(xp);}
#define XFREE(p, h, t) {void* xp = (p); (void)(h); (void)(t); if (xp) wolfSSL_Free(xp);}
#endif
#define XREALLOC(p, n, h, t) wolfSSL_Realloc((p), (n))
#define XREALLOC(p, n, h, t) ((void)(h), (void)(t), wolfSSL_Realloc((p), (n)))
#endif /* WOLFSSL_DEBUG_MEMORY */
#endif /* WOLFSSL_STATIC_MEMORY */
#endif
Expand Down

0 comments on commit 73ca6da

Please sign in to comment.