fixed leak of method when ctx malloc fails; implemented get_shutdown

This commit is contained in:
John Safranek
2013-04-03 16:35:19 -07:00
parent 217254b533
commit 786e4d9462

View File

@@ -134,6 +134,10 @@ CYASSL_CTX* CyaSSL_CTX_new(CYASSL_METHOD* method)
ctx = NULL;
}
}
else {
CYASSL_MSG("Alloc CTX failed, method freed");
XFREE(method, NULL, DYNAMIC_TYPE_METHOD);
}
CYASSL_LEAVE("CYASSL_CTX_new", 0);
return ctx;
@@ -5491,13 +5495,6 @@ int CyaSSL_set_compression(CYASSL* ssl)
}
int CyaSSL_get_shutdown(const CYASSL* ssl)
{
(void)ssl;
return 0;
}
int CyaSSL_set_session_id_context(CYASSL* ssl, const unsigned char* id,
unsigned int len)
{
@@ -5515,6 +5512,14 @@ int CyaSSL_set_compression(CYASSL* ssl)
}
#endif
int CyaSSL_get_shutdown(const CYASSL* ssl)
{
return (ssl->options.isClosed ||
ssl->options.connReset ||
ssl->options.sentNotify);
}
int CyaSSL_session_reused(CYASSL* ssl)
{
return ssl->options.resuming;