diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2013-03-15 16:22:57 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2013-06-19 15:20:55 +0800 |
commit | 3c15867260dd6ccee81bc358b07a77eaeb38585e (patch) | |
tree | 4baf2d143b6d2169709daf6d398300aaf22880d1 /va | |
parent | 5b7741250252600aac4195114bb1917112780387 (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.c | 12 | ||||
-rw-r--r-- | va/va.c | 1 |
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 @@ -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; } |