summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-21 14:17:59 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-21 14:17:59 +0000
commitc6ccbf04ae8bb7de2ec919bfb22104864adc1c0d (patch)
treec1bb7a4b0a5b151c0c383b5797e3262a84868dca
parent8cd250c0f18abaf4b75803427571de42c723dfbe (diff)
crash fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@14302 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--src/mir_app/src/netlibopenconn.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/mir_app/src/netlibopenconn.cpp b/src/mir_app/src/netlibopenconn.cpp
index 83e34eb428..d20a2d670b 100644
--- a/src/mir_app/src/netlibopenconn.cpp
+++ b/src/mir_app/src/netlibopenconn.cpp
@@ -343,16 +343,19 @@ static void FreePartiallyInitedConnection(NetlibConnection *nlc)
{
DWORD dwOriginalLastError = GetLastError();
- if (nlc->s != INVALID_SOCKET) closesocket(nlc->s);
- mir_free(nlc->nlhpi.szHttpPostUrl);
- mir_free(nlc->nlhpi.szHttpGetUrl);
- mir_free((char*)nlc->nloc.szHost);
- mir_free(nlc->szProxyServer);
- NetlibDeleteNestedCS(&nlc->ncsSend);
- NetlibDeleteNestedCS(&nlc->ncsRecv);
- CloseHandle(nlc->hOkToCloseEvent);
- DeleteCriticalSection(&nlc->csHttpSequenceNums);
- mir_free(nlc);
+ if (GetNetlibHandleType(nlc) == NLH_CONNECTION) {
+ if (nlc->s != INVALID_SOCKET)
+ closesocket(nlc->s);
+ mir_free(nlc->nlhpi.szHttpPostUrl);
+ mir_free(nlc->nlhpi.szHttpGetUrl);
+ mir_free((char*)nlc->nloc.szHost);
+ mir_free(nlc->szProxyServer);
+ NetlibDeleteNestedCS(&nlc->ncsSend);
+ NetlibDeleteNestedCS(&nlc->ncsRecv);
+ CloseHandle(nlc->hOkToCloseEvent);
+ DeleteCriticalSection(&nlc->csHttpSequenceNums);
+ mir_free(nlc);
+ }
SetLastError(dwOriginalLastError);
}
@@ -674,7 +677,7 @@ static int NetlibHttpFallbackToDirect(NetlibConnection *nlc, NetlibUser *nlu, NE
nlc->proxyAuthNeeded = false;
nlc->proxyType = 0;
- mir_free(nlc->szProxyServer); nlc->szProxyServer = NULL;
+ replaceStr(nlc->szProxyServer, NULL);
if (!my_connect(nlc, nloc)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "connect", WSAGetLastError());
return false;
@@ -687,7 +690,7 @@ bool NetlibDoConnect(NetlibConnection *nlc)
NETLIBOPENCONNECTION *nloc = &nlc->nloc;
NetlibUser *nlu = nlc->nlu;
- mir_free(nlc->szProxyServer); nlc->szProxyServer = NULL;
+ replaceStr(nlc->szProxyServer, NULL);
bool usingProxy = false, forceHttps = false;
if (nlu->settings.useProxy) {