[Spice-devel] [PATCH 2/7] Grab malloc_sem in FreeMem

Yonit Halperin yhalperi at redhat.com
Tue Aug 24 03:56:11 PDT 2010


On 08/24/2010 11:41 AM, alexl at redhat.com wrote:
> From: Alexander Larsson<alexl at redhat.com>
>
> This is needed as much as in AllocMem to protect the mspaces data
> from concurrent access.
> ---
>   display/res.c |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/display/res.c b/display/res.c
> index 1f67dbf..6fe375f 100644
> --- a/display/res.c
> +++ b/display/res.c
> @@ -337,7 +337,9 @@ static void FreeMem(PDev* pdev, UINT32 mspace_type, void *ptr)
>       ASSERT(pdev, pdev&&  pdev->Res.mspaces[mspace_type]._mspace);
>       ASSERT(pdev, (UINT8 *)ptr>= pdev->Res.mspaces[mspace_type].mspace_start&&
>                    (UINT8 *)ptr<  pdev->Res.mspaces[mspace_type].mspace_end);
> +    EngAcquireSemaphore(pdev->Res.malloc_sem);
>       mspace_free(pdev->Res.mspaces[mspace_type]._mspace, ptr);
> +    EngReleaseSemaphore(pdev->Res.malloc_sem);
>   }
>
>   DevRes *global_res = NULL;
Ack


More information about the Spice-devel mailing list