Module: wine Branch: master Commit: d34aba2a1c4b3aa781f3bba822f02748adca8f76 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d34aba2a1c4b3aa781f3bba822...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Tue Jan 5 21:29:03 2010 +0100
avifil32: Don't leak the buffer on HeapReAlloc() failure in AVISaveOptionsFmtChoose().
---
dlls/avifil32/api.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/avifil32/api.c b/dlls/avifil32/api.c index 8107b47..c3dc72f 100644 --- a/dlls/avifil32/api.c +++ b/dlls/avifil32/api.c @@ -1225,13 +1225,14 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd) acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FORMAT, &size); if ((pOptions->cbFormat == 0 || pOptions->lpFormat == NULL) && size != 0) { pOptions->lpFormat = HeapAlloc(GetProcessHeap(), 0, size); + if (!pOptions->lpFormat) return FALSE; pOptions->cbFormat = size; } else if (pOptions->cbFormat < (DWORD)size) { - pOptions->lpFormat = HeapReAlloc(GetProcessHeap(), 0, pOptions->lpFormat, size); + void *new_buffer = HeapReAlloc(GetProcessHeap(), 0, pOptions->lpFormat, size); + if (!new_buffer) return FALSE; + pOptions->lpFormat = new_buffer; pOptions->cbFormat = size; } - if (pOptions->lpFormat == NULL) - return FALSE; afmtc.pwfx = pOptions->lpFormat; afmtc.cbwfx = pOptions->cbFormat;