fix resource leak on bad user cert chain big buffer

This commit is contained in:
toddouska
2014-05-02 10:30:07 -07:00
parent 3e62da0bc9
commit 4104b74c40

View File

@ -1977,6 +1977,8 @@ int CyaSSL_Init(void)
if (ret < 0) {
CYASSL_MSG(" Error in Cert in Chain");
if (dynamicBuffer)
XFREE(chainBuffer, heap, DYNAMIC_TYPE_FILE);
XFREE(der.buffer, heap, dynamicType);
return ret;
}
@ -1986,6 +1988,9 @@ int CyaSSL_Init(void)
if (ctx == NULL) {
CYASSL_MSG("certChain needs context");
if (dynamicBuffer)
XFREE(chainBuffer, heap, DYNAMIC_TYPE_FILE);
XFREE(der.buffer, heap, dynamicType);
return BAD_FUNC_ARG;
}
ctx->certChain.buffer = (byte*)XMALLOC(idx, heap,