Re: [1/3] wininet: Check for bad allocation in HeapReAlloc
June 2, 2009
5:08 a.m.
Jason Green <jave27(a)gmail.com> writes:
@@ -4213,10 +4213,10 @@ static INT HTTP_GetResponseHeaders(LPWININETHTTPREQW lpwhr, BOOL clear)
/* regenerate raw headers */ while (cchRawHeaders + buflen + strlenW(szCrLf) > cchMaxRawHeaders) - { cchMaxRawHeaders *= 2; - lpszRawHeaders = HeapReAlloc(GetProcessHeap(), 0, lpszRawHeaders, (cchMaxRawHeaders+1)*sizeof(WCHAR)); - } + lpszRawHeaders = HeapReAlloc(GetProcessHeap(), 0, lpszRawHeaders, (cchMaxRawHeaders+1)*sizeof(WCHAR)); + if (lpszRawHeaders == NULL) + goto lend;
If you are going to check the allocation, then you should handle the error properly too instead of leaking memory. -- Alexandre Julliard julliard(a)winehq.org
6140
Age (days ago)
6140
Last active (days ago)
0 comments
1 participants
participants (1)
-
Alexandre Julliard