From: Austin Yuan Date: Sun, 1 Feb 2009 16:54:54 +0000 (-0500) Subject: Fixed issues reported by Klockwork X-Git-Tag: 20090306~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a59133d8bdb2418b45f95279ff00146363701a64;p=platform%2Fupstream%2Flibva.git Fixed issues reported by Klockwork Signed-off-by: Austin Yuan --- diff --git a/dummy_drv_video/dummy_drv_video.c b/dummy_drv_video/dummy_drv_video.c index 3ba1ee9..bc2ea2a 100644 --- a/dummy_drv_video/dummy_drv_video.c +++ b/dummy_drv_video/dummy_drv_video.c @@ -736,6 +736,12 @@ VAStatus dummy_CreateContext( obj_context->picture_height = picture_height; obj_context->num_render_targets = num_render_targets; obj_context->render_targets = (VASurfaceID *) malloc(num_render_targets * sizeof(VASurfaceID)); + if (obj_context->render_targets == NULL) + { + vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED; + return vaStatus; + } + for(i = 0; i < num_render_targets; i++) { if (NULL == SURFACE(render_targets[i])) diff --git a/src/X11/va_x11.c b/src/X11/va_x11.c index 2d129a9..7bad12b 100644 --- a/src/X11/va_x11.c +++ b/src/X11/va_x11.c @@ -145,11 +145,11 @@ static VAStatus va_DisplayContextGetDriverName ( vaStatus = VA_STATUS_SUCCESS; va_infoMessage("VA_DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n", driver_major, driver_minor, driver_patch, x_driver_name, ctx->x11_screen); - if (driver_name) + if (driver_name) *driver_name = strdup(x_driver_name); } if (x_driver_name) - XFree(x_driver_name); + XFree(x_driver_name); return vaStatus; } diff --git a/src/va.c b/src/va.c index 2bfeb49..d5aed08 100644 --- a/src/va.c +++ b/src/va.c @@ -143,10 +143,10 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name) char *driver_path = (char *) malloc( strlen(driver_dir) + strlen(driver_name) + strlen(DRIVER_EXTENSION) + 2 ); - strcpy( driver_path, driver_dir ); - strcat( driver_path, "/" ); - strcat( driver_path, driver_name ); - strcat( driver_path, DRIVER_EXTENSION ); + strncpy( driver_path, driver_dir, strlen(driver_dir) ); + strncat( driver_path, "/", strlen("/") ); + strncat( driver_path, driver_name, strlen(driver_name) ); + strncat( driver_path, DRIVER_EXTENSION, strlen(DRIVER_EXTENSION) ); va_infoMessage("Trying to open %s\n", driver_path);