summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGwenole Beauchesne <gbeauchesne@splitted-desktop.com>2009-07-08 07:53:37 +0000
committerAustin Yuan <shengquan.yuan@intel.com>2009-07-08 17:42:05 +0800
commit2496bb03f3e70bcbee39ab84c1780ccbd57e97be (patch)
tree84c398dcf5e350002cb77789e4e9d5955bce6769 /src
parent0108c576ab09ac33c5edaee78bcc468527e32da8 (diff)
downloadlibva-2496bb03f3e70bcbee39ab84c1780ccbd57e97be.tar.gz
Fix memory leak (VADriverContext.dri_state).
Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/x11/va_x11.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/x11/va_x11.c b/src/x11/va_x11.c
index 5e69d6b..46911fc 100644
--- a/src/x11/va_x11.c
+++ b/src/x11/va_x11.c
@@ -93,6 +93,7 @@ static void va_DisplayContextDestroy (
}
ctx = &((*ctx)->pNext);
}
+ free(pDisplayContext->pDriverContext->dri_state);
free(pDisplayContext->pDriverContext);
free(pDisplayContext);
}
@@ -197,9 +198,11 @@ VADisplay vaGetDisplay (
{
/* create new entry */
VADriverContextP pDriverContext;
+ struct dri_state *dri_state;
pDisplayContext = calloc(1, sizeof(*pDisplayContext));
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->x11_dpy = native_dpy;
@@ -209,7 +212,7 @@ VADisplay vaGetDisplay (
pDisplayContext->vaDestroy = va_DisplayContextDestroy;
pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
pDisplayContexts = pDisplayContext;
- pDriverContext->dri_state = calloc(1, sizeof(struct dri_state));
+ pDriverContext->dri_state = dri_state;
dpy = (VADisplay)pDisplayContext;
}
else
@@ -218,6 +221,8 @@ VADisplay vaGetDisplay (
free(pDisplayContext);
if (pDriverContext)
free(pDriverContext);
+ if (dri_state)
+ free(dri_state);
}
}