setting pointers to NULL after freeing memory to avoid crashes.

gitignore: only top-level "external" folder is ignored.
This commit is contained in:
Benoît LeBlanc 2013-10-22 17:05:41 -04:00
parent 3951a6e1c3
commit 5bfca61261
3 changed files with 19 additions and 5 deletions

2
.gitignore vendored
View File

@ -15,7 +15,7 @@ DartConfiguration.tcl
CMakeCPackOptions.cmake
_CPack_Packages
LICENSE.txt
external/*
/external/*
!external/README
*.a.objlist.cmake

View File

@ -70,10 +70,13 @@ rdpContext* freerdp_client_context_new(RDP_CLIENT_ENTRY_POINTS* pEntryPoints)
void freerdp_client_context_free(rdpContext* context)
{
freerdp* instance = context->instance;
freerdp_context_free(instance);
free(instance->pClientEntryPoints);
freerdp_free(instance);
if (instance)
{
freerdp_context_free(instance);
free(instance->pClientEntryPoints);
freerdp_free(instance);
context->instance = NULL;
}
}
int freerdp_client_start(rdpContext* context)

View File

@ -798,21 +798,32 @@ void tls_free(rdpTls* tls)
if (tls != NULL)
{
if (tls->ssl)
{
SSL_free(tls->ssl);
tls->ssl = NULL;
}
if (tls->ctx)
{
SSL_CTX_free(tls->ctx);
tls->ctx = NULL;
}
if (tls->PublicKey)
{
free(tls->PublicKey);
tls->PublicKey = NULL;
}
if (tls->Bindings)
{
free(tls->Bindings->Bindings);
free(tls->Bindings);
tls->Bindings = NULL;
}
certificate_store_free(tls->certificate_store);
tls->certificate_store = NULL;
free(tls);
}