audin: fix incorrect usage of realloc.

Signed-off-by: Zhang Zhaolong <zhangzl2013@126.com>
This commit is contained in:
Zhang Zhaolong 2015-03-11 11:10:28 +08:00
parent b8de622b90
commit d329831ba1

View File

@ -213,8 +213,13 @@ static BOOL audin_winmm_format_supported(IAudinDevice* device, audinFormat* form
{ {
if (winmm->cFormats >= winmm->ppwfx_size) if (winmm->cFormats >= winmm->ppwfx_size)
{ {
PWAVEFORMATEX *tmp_ppwfx;
tmp_ppwfx = realloc(winmm->ppwfx, sizeof(PWAVEFORMATEX) * winmm->ppwfx_size * 2);
if (!tmp_ppwfx)
return 0;
winmm->ppwfx_size *= 2; winmm->ppwfx_size *= 2;
winmm->ppwfx = realloc(winmm->ppwfx, sizeof(PWAVEFORMATEX) * winmm->ppwfx_size); winmm->ppwfx = tmp_ppwfx;
} }
winmm->ppwfx[winmm->cFormats++] = pwfx; winmm->ppwfx[winmm->cFormats++] = pwfx;