libva: fix memeory leaks in libva
authorEdgar Hucek <gimli@dark-green.com>
Mon, 13 Jun 2011 05:46:06 +0000 (13:46 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Mon, 13 Jun 2011 05:46:06 +0000 (13:46 +0800)
Signed-off-by: Edgar Hucek <gimli@dark-green.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
va/x11/dri2_util.c
va/x11/va_x11.c

index 298cd31..8a6dd4f 100644 (file)
@@ -193,6 +193,9 @@ isDRI2Connected(VADriverContextP ctx, char **driver_name)
     dri_state->close = dri2Close;
     gsDRI2SwapAvailable = (minor >= 2);
 
+    if (device_name)
+        Xfree(device_name);
+
     return True;
 
 err_out:
index fd7e517..0d62534 100644 (file)
@@ -54,9 +54,18 @@ static void va_DisplayContextDestroy (
     VADisplayContextP pDisplayContext
 )
 {
+    VADriverContextP ctx;
+    struct dri_state *dri_state;
+
     if (pDisplayContext == NULL)
         return;
 
+    ctx = pDisplayContext->pDriverContext;
+    dri_state = ctx->dri_state;
+
+    if (dri_state)
+        dri_state->close(ctx);
+
     free(pDisplayContext->pDriverContext->dri_state);
     free(pDisplayContext->pDriverContext);
     free(pDisplayContext);