Commit d34aba2a authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

avifil32: Don't leak the buffer on HeapReAlloc() failure in AVISaveOptionsFmtChoose().

parent 7ab71039
...@@ -1225,13 +1225,14 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd) ...@@ -1225,13 +1225,14 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FORMAT, &size); acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FORMAT, &size);
if ((pOptions->cbFormat == 0 || pOptions->lpFormat == NULL) && size != 0) { if ((pOptions->cbFormat == 0 || pOptions->lpFormat == NULL) && size != 0) {
pOptions->lpFormat = HeapAlloc(GetProcessHeap(), 0, size); pOptions->lpFormat = HeapAlloc(GetProcessHeap(), 0, size);
if (!pOptions->lpFormat) return FALSE;
pOptions->cbFormat = size; pOptions->cbFormat = size;
} else if (pOptions->cbFormat < (DWORD)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; pOptions->cbFormat = size;
} }
if (pOptions->lpFormat == NULL)
return FALSE;
afmtc.pwfx = pOptions->lpFormat; afmtc.pwfx = pOptions->lpFormat;
afmtc.cbwfx = pOptions->cbFormat; afmtc.cbwfx = pOptions->cbFormat;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment