From 8e1b1a7e93b9aafe60e931fed4602c6cd92c44ad Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Wed, 30 Mar 2011 15:45:07 +0300 Subject: [PATCH] gpu: pvr: fix incorrect free size in PVRSRVOpenBCDeviceKM Also remove the always true condition. Signed-off-by: Imre Deak Reviewed-by: Pauli Nieminen --- pvr/deviceclass.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pvr/deviceclass.c b/pvr/deviceclass.c index 826f2a7..cfbe18e 100644 --- a/pvr/deviceclass.c +++ b/pvr/deviceclass.c @@ -1304,6 +1304,7 @@ enum PVRSRV_ERROR PVRSRVOpenBCDeviceKM( struct PVRSRV_BUFFERCLASS_INFO *psBCInfo; struct PVRSRV_BUFFERCLASS_PERCONTEXT_INFO *psBCPerContextInfo; struct PVRSRV_DEVICE_NODE *psDeviceNode; + struct BUFFER_INFO sBufferInfo; struct SYS_DATA *psSysData; u32 i; enum PVRSRV_ERROR eError; @@ -1351,8 +1352,6 @@ FoundDevice: OSMemSet(psBCPerContextInfo, 0, sizeof(*psBCPerContextInfo)); if (psBCInfo->ui32RefCount++ == 0) { - struct BUFFER_INFO sBufferInfo; - psDeviceNode = (struct PVRSRV_DEVICE_NODE *)hDevCookie; psBCInfo->hDevMemContext = @@ -1445,12 +1444,9 @@ err3: psKernelSyncInfo); } } - - if (psBCInfo->psBuffer) { - OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, - sizeof(struct PVRSRV_BC_BUFFER), psBCInfo->psBuffer, - NULL); - } + OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, + sizeof(struct PVRSRV_BC_BUFFER) * sBufferInfo.ui32BufferCount, + psBCInfo->psBuffer, NULL); err2: err1: return eError; -- 2.39.5