Indeed. Does need to be one line up.
Thanks
You are not logged in. Please login or register.
Please post questions or comments you have about wolfSSL products here. It is helpful to be as descriptive as possible when asking your questions.
ReferenceswolfSSL - Embedded SSL Library → Posts by odellcraig
Pages 1
Indeed. Does need to be one line up.
Thanks
I found a memory leak in wolfSSL. The memory leak is small, but impacted me since I'm working on a very resource constrained embedded ssl system.
Memory Leak:
struct CYASSL_CTX::countMutex is initialized but never freed
This mutex is initialized in InitSSL_Ctx() (internal.c) and should be freed in FreeSSL_Ctx() (also internal.c).
I have changed:
void FreeSSL_Ctx(CYASSL_CTX* ctx)
{
int doFree = 0;
if (LockMutex(&ctx->countMutex) != 0) {
CYASSL_MSG("Couldn't lock count mutex");
return;
}
ctx->refCount--;
if (ctx->refCount == 0)
doFree = 1;
UnLockMutex(&ctx->countMutex);
if (doFree) {
CYASSL_MSG("CTX ref count down to 0, doing full free");
SSL_CtxResourceFree(ctx);
XFREE(ctx, ctx->heap, DYNAMIC_TYPE_CTX);
}
else {
(void)ctx;
CYASSL_MSG("CTX ref count not 0 yet, no free");
}
}
to
void FreeSSL_Ctx(CYASSL_CTX* ctx)
{
int doFree = 0;
if (LockMutex(&ctx->countMutex) != 0) {
CYASSL_MSG("Couldn't lock count mutex");
return;
}
ctx->refCount--;
if (ctx->refCount == 0)
doFree = 1;
UnLockMutex(&ctx->countMutex);
if (doFree) {
CYASSL_MSG("CTX ref count down to 0, doing full free");
SSL_CtxResourceFree(ctx);
XFREE(ctx, ctx->heap, DYNAMIC_TYPE_CTX);
FreeMutex(&ctx->countMutex); //***** This Free was missing *****
}
else {
(void)ctx;
CYASSL_MSG("CTX ref count not 0 yet, no free");
}
}
Wasn't sure how to submit bugs, but thought I would post it here in case anyone else out there is as resource constrained as I am.
Pages 1
wolfSSL - Embedded SSL Library → Posts by odellcraig
Powered by PunBB, supported by Informer Technologies, Inc.
Generated in 0.016 seconds (95% PHP - 5% DB) with 5 queries