Commit 2496bb03 authored by Gwenole Beauchesne's avatar Gwenole Beauchesne Committed by Austin Yuan

Fix memory leak (VADriverContext.dri_state).

Signed-off-by: default avatarAustin Yuan <shengquan.yuan@intel.com>
parent 0108c576
...@@ -93,6 +93,7 @@ static void va_DisplayContextDestroy ( ...@@ -93,6 +93,7 @@ static void va_DisplayContextDestroy (
} }
ctx = &((*ctx)->pNext); ctx = &((*ctx)->pNext);
} }
free(pDisplayContext->pDriverContext->dri_state);
free(pDisplayContext->pDriverContext); free(pDisplayContext->pDriverContext);
free(pDisplayContext); free(pDisplayContext);
} }
...@@ -197,9 +198,11 @@ VADisplay vaGetDisplay ( ...@@ -197,9 +198,11 @@ VADisplay vaGetDisplay (
{ {
/* create new entry */ /* create new entry */
VADriverContextP pDriverContext; VADriverContextP pDriverContext;
struct dri_state *dri_state;
pDisplayContext = calloc(1, sizeof(*pDisplayContext)); pDisplayContext = calloc(1, sizeof(*pDisplayContext));
pDriverContext = calloc(1, sizeof(*pDriverContext)); pDriverContext = calloc(1, sizeof(*pDriverContext));
if (pDisplayContext && pDriverContext) dri_state = calloc(1, sizeof(*dri_state));
if (pDisplayContext && pDriverContext && dri_state)
{ {
pDriverContext->old_pNext = (void *)(unsigned long)0xdeadbeef; pDriverContext->old_pNext = (void *)(unsigned long)0xdeadbeef;
pDriverContext->x11_dpy = native_dpy; pDriverContext->x11_dpy = native_dpy;
...@@ -209,7 +212,7 @@ VADisplay vaGetDisplay ( ...@@ -209,7 +212,7 @@ VADisplay vaGetDisplay (
pDisplayContext->vaDestroy = va_DisplayContextDestroy; pDisplayContext->vaDestroy = va_DisplayContextDestroy;
pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName; pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
pDisplayContexts = pDisplayContext; pDisplayContexts = pDisplayContext;
pDriverContext->dri_state = calloc(1, sizeof(struct dri_state)); pDriverContext->dri_state = dri_state;
dpy = (VADisplay)pDisplayContext; dpy = (VADisplay)pDisplayContext;
} }
else else
...@@ -218,6 +221,8 @@ VADisplay vaGetDisplay ( ...@@ -218,6 +221,8 @@ VADisplay vaGetDisplay (
free(pDisplayContext); free(pDisplayContext);
if (pDriverContext) if (pDriverContext)
free(pDriverContext); free(pDriverContext);
if (dri_state)
free(dri_state);
} }
} }
......
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