From c7b0966057e567854aefd057b65b3c09b795b748 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Tue, 16 Dec 2014 14:57:50 +0000 Subject: -Fixed memory leak git-svn-id: http://svn.miranda-ng.org/main/trunk@11465 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/netlib/netlibsecurity.cpp | 19 ++++++++++++------- src/modules/netlib/netlibupnp.cpp | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp index 395d7f8dd1..eb96625a01 100644 --- a/src/modules/netlib/netlibsecurity.cpp +++ b/src/modules/netlib/netlibsecurity.cpp @@ -411,7 +411,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, return NULL; if (!http) - return mir_strdup(szOutputToken); + return szOutputToken; ptrA szProvider( mir_t2a(hNtlm->szProvider)); size_t resLen = strlen(szOutputToken) + strlen(szProvider) + 10; @@ -432,7 +432,8 @@ static INT_PTR InitSecurityProviderService(WPARAM, LPARAM lParam) static INT_PTR InitSecurityProviderService2(WPARAM, LPARAM lParam) { NETLIBNTLMINIT2 *req = (NETLIBNTLMINIT2*)lParam; - if (req->cbSize < sizeof(*req)) return 0; + if (req == NULL || req->cbSize < sizeof(*req)) + return 0; HANDLE hSecurity; @@ -452,10 +453,13 @@ static INT_PTR DestroySecurityProviderService(WPARAM, LPARAM lParam) static INT_PTR NtlmCreateResponseService(WPARAM wParam, LPARAM lParam) { - NETLIBNTLMREQUEST* req = (NETLIBNTLMREQUEST*)lParam; - unsigned complete; + NETLIBNTLMREQUEST *req = (NETLIBNTLMREQUEST*)lParam; + if (req == NULL) + return 0; - char* response = NtlmCreateResponseFromChallenge((HANDLE)wParam, req->szChallenge, + unsigned complete = 0; + + char *response = NtlmCreateResponseFromChallenge((HANDLE)wParam, req->szChallenge, StrConvT(req->userName), StrConvT(req->password), false, complete); return (INT_PTR)response; @@ -463,8 +467,9 @@ static INT_PTR NtlmCreateResponseService(WPARAM wParam, LPARAM lParam) static INT_PTR NtlmCreateResponseService2(WPARAM wParam, LPARAM lParam) { - NETLIBNTLMREQUEST2* req = (NETLIBNTLMREQUEST2*)lParam; - if (req->cbSize < sizeof(*req)) return 0; + NETLIBNTLMREQUEST2 *req = (NETLIBNTLMREQUEST2*)lParam; + if (req == NULL || req->cbSize < sizeof(*req)) + return 0; char* response; diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp index 1775bbd886..b0af8dc05d 100644 --- a/src/modules/netlib/netlibupnp.cpp +++ b/src/modules/netlib/netlibupnp.cpp @@ -246,7 +246,7 @@ static int httpTransact(char* szUrl, char* szResult, int resSize, char* szAction char szHost[256], szPath[256], szRes[16]; int sz = 0, res = 0; unsigned short sPort; - bool needClose; + bool needClose = false; const char* szPostHdr = soap_post_hdr; char* szData = (char*)mir_alloc(4096); -- cgit v1.2.3