Fix double-free crash on TLS failure.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5709 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2020-06-27 19:31:48 +00:00
parent dfc44e5d36
commit 08f8cb2d35
2 changed files with 1 additions and 10 deletions

View file

@ -1185,10 +1185,8 @@ vfsfile_t *GNUTLS_OpenVFS(const char *hostname, vfsfile_t *source, qboolean isse
newf = Z_Malloc(sizeof(*newf)); newf = Z_Malloc(sizeof(*newf));
if (!newf) if (!newf)
{ {
VFS_CLOSE(source);
return NULL; return NULL;
} }
newf->stream = source;
newf->funcs.Close = SSL_CloseFile; newf->funcs.Close = SSL_CloseFile;
newf->funcs.Flush = NULL; newf->funcs.Flush = NULL;
newf->funcs.GetLen = SSL_GetLen; newf->funcs.GetLen = SSL_GetLen;
@ -1208,6 +1206,7 @@ vfsfile_t *GNUTLS_OpenVFS(const char *hostname, vfsfile_t *source, qboolean isse
VFS_CLOSE(&newf->funcs); VFS_CLOSE(&newf->funcs);
return NULL; return NULL;
} }
newf->stream = source;
return &newf->funcs; return &newf->funcs;
} }

View file

@ -988,11 +988,7 @@ vfsfile_t *SSPI_OpenVFS(const char *servername, vfsfile_t *source, qboolean serv
const char *peername; const char *peername;
if (!source || !SSL_Inited()) if (!source || !SSL_Inited())
{
if (source)
VFS_CLOSE(source);
return NULL; return NULL;
}
if (server) if (server)
{ {
// localname = servername; // localname = servername;
@ -1006,10 +1002,7 @@ vfsfile_t *SSPI_OpenVFS(const char *servername, vfsfile_t *source, qboolean serv
/* /*
if (server) //unsupported if (server) //unsupported
{
VFS_CLOSE(source);
return NULL; return NULL;
}
*/ */
newf = Z_Malloc(sizeof(*newf)); newf = Z_Malloc(sizeof(*newf));
@ -1025,7 +1018,6 @@ vfsfile_t *SSPI_OpenVFS(const char *servername, vfsfile_t *source, qboolean serv
if (err) if (err)
{ {
Z_Free(newf); Z_Free(newf);
VFS_CLOSE(source);
return NULL; return NULL;
} }
} }