Module: wine Branch: master Commit: 2f4968b5979c9cc83d79825a442b3172b7a1cd2a URL: http://source.winehq.org/git/wine.git/?a=commit;h=2f4968b5979c9cc83d79825a44...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Jan 13 13:54:38 2011 +0100
wininet: Fixed memory leak in tests (valgrind).
---
dlls/wininet/tests/http.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 16a29ce..2b0092a 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -2592,6 +2592,15 @@ static void test_http_connection(void) CloseHandle(hThread); }
+static void release_cert_info(INTERNET_CERTIFICATE_INFOA *info) +{ + LocalFree(info->lpszSubjectInfo); + LocalFree(info->lpszIssuerInfo); + LocalFree(info->lpszProtocolName); + LocalFree(info->lpszSignatureAlgName); + LocalFree(info->lpszEncryptionAlgName); +} + static void test_secure_connection(void) { static const WCHAR gizmo5[] = {'G','i','z','m','o','5',0}; @@ -2627,6 +2636,7 @@ static void test_secure_connection(void) ret = InternetQueryOptionA(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, NULL, &size); ok(ret || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %d\n", GetLastError()); + ok(size == sizeof(INTERNET_CERTIFICATE_INFOA), "size = %d\n", size); certificate_structA = HeapAlloc(GetProcessHeap(), 0, size); ret = InternetQueryOption(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, certificate_structA, &size); @@ -2646,6 +2656,7 @@ static void test_secure_connection(void) ok(!certificate_structA->lpszProtocolName, "unexpected protocol name\n"); ok(certificate_structA->dwKeySize, "expected a non-zero key size\n"); + release_cert_info(certificate_structA); } HeapFree(GetProcessHeap(), 0, certificate_structA);
@@ -2656,6 +2667,7 @@ static void test_secure_connection(void) ret = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, NULL, &size); ok(ret || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %d\n", GetLastError()); + ok(size == sizeof(INTERNET_CERTIFICATE_INFOW), "size = %d\n", size); certificate_structW = HeapAlloc(GetProcessHeap(), 0, size); ret = InternetQueryOption(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, certificate_structW, &size); @@ -2676,6 +2688,7 @@ static void test_secure_connection(void) ok(!certificate_structA->lpszProtocolName, "unexpected protocol name\n"); ok(certificate_structA->dwKeySize, "expected a non-zero key size\n"); + release_cert_info(certificate_structA); } HeapFree(GetProcessHeap(), 0, certificate_structW);
@@ -2707,6 +2720,7 @@ static void test_secure_connection(void) ret = InternetQueryOptionA(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, NULL, &size); ok(ret || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %d\n", GetLastError()); + ok(size == sizeof(INTERNET_CERTIFICATE_INFOA), "size = %d\n", size); certificate_structA = HeapAlloc(GetProcessHeap(), 0, size); ret = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, certificate_structA, &size); @@ -2726,6 +2740,7 @@ static void test_secure_connection(void) ok(!certificate_structA->lpszProtocolName, "unexpected protocol name\n"); ok(certificate_structA->dwKeySize, "expected a non-zero key size\n"); + release_cert_info(certificate_structA); } HeapFree(GetProcessHeap(), 0, certificate_structA);
@@ -2736,6 +2751,7 @@ static void test_secure_connection(void) ret = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, NULL, &size); ok(ret || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %d\n", GetLastError()); + ok(size == sizeof(INTERNET_CERTIFICATE_INFOW), "size = %d\n", size); certificate_structW = HeapAlloc(GetProcessHeap(), 0, size); ret = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, certificate_structW, &size); @@ -2756,6 +2772,7 @@ static void test_secure_connection(void) ok(!certificate_structA->lpszProtocolName, "unexpected protocol name\n"); ok(certificate_structA->dwKeySize, "expected a non-zero key size\n"); + release_cert_info(certificate_structA); } HeapFree(GetProcessHeap(), 0, certificate_structW);