summaryrefslogtreecommitdiff
path: root/va
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2013-03-15 16:22:57 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2013-06-19 15:20:55 +0800
commit3c15867260dd6ccee81bc358b07a77eaeb38585e (patch)
tree4baf2d143b6d2169709daf6d398300aaf22880d1 /va
parent5b7741250252600aac4195114bb1917112780387 (diff)
Fix possible memory leak
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> (cherry picked from commit 0b07495fc24646b47952b8df7d4e6d2df2a0f72c)
Diffstat (limited to 'va')
-rw-r--r--va/glx/va_glx_impl.c12
-rw-r--r--va/va.c1
2 files changed, 10 insertions, 3 deletions
diff --git a/va/glx/va_glx_impl.c b/va/glx/va_glx_impl.c
index f317961..5299589 100644
--- a/va/glx/va_glx_impl.c
+++ b/va/glx/va_glx_impl.c
@@ -882,19 +882,25 @@ vaCreateSurfaceGLX_impl_libva(
gl_get_current_context(&old_cs);
new_cs = gl_create_context(ctx, &old_cs);
if (!new_cs)
- return VA_STATUS_ERROR_ALLOCATION_FAILED;
+ goto error;
if (!gl_set_current_context(new_cs, NULL))
- return VA_STATUS_ERROR_OPERATION_FAILED;
+ goto error;
pSurfaceGLX = create_surface(ctx, target, texture);
if (!pSurfaceGLX)
- return VA_STATUS_ERROR_ALLOCATION_FAILED;
+ goto error;
pSurfaceGLX->gl_context = new_cs;
*gl_surface = pSurfaceGLX;
gl_set_current_context(&old_cs, NULL);
return VA_STATUS_SUCCESS;
+
+error:
+ if (new_cs)
+ gl_destroy_context(new_cs);
+
+ return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
static VAStatus
diff --git a/va/va.c b/va/va.c
index 851a41f..9ad2db4 100644
--- a/va/va.c
+++ b/va/va.c
@@ -217,6 +217,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
if (!driver_path) {
va_errorMessage("%s L%d Out of memory!n",
__FUNCTION__, __LINE__);
+ free(search_path);
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}