[Libva] [PATCH 1/5] add assert to check for potential NULL issue in test_XX

Xiang, Haihao haihao.xiang at intel.com
Fri Jul 22 07:51:01 UTC 2016


Applied this series of patches.

Thanks
Haihao


> Signed-off-by: Lim Siew Hoon <siew.hoon.lim at intel.com>
> ---
>  test/basic/test_05.c | 1 +
>  test/basic/test_06.c | 1 +
>  test/basic/test_09.c | 3 +++
>  test/basic/test_10.c | 1 +
>  test/basic/test_11.c | 1 +
>  5 files changed, 7 insertions(+)
> 
> diff --git a/test/basic/test_05.c b/test/basic/test_05.c
> index 233aa01..a05100d 100644
> --- a/test/basic/test_05.c
> +++ b/test/basic/test_05.c
> @@ -44,6 +44,7 @@ void test()
>      ASSERT(entrypoints);
>  
>      VAConfigID *configs = malloc(max_entrypoints * num_profiles *
> sizeof(VAConfigID));
> +    ASSERT(configs);
>  
>      for(i = 0; i < num_profiles; i++)
>      {
> diff --git a/test/basic/test_06.c b/test/basic/test_06.c
> index 0dfdee5..e782d81 100644
> --- a/test/basic/test_06.c
> +++ b/test/basic/test_06.c
> @@ -74,6 +74,7 @@ void test()
>      ASSERT(max_attribs > 0);
>  
>      VAConfigAttrib *attrib_list = malloc(max_attribs *
> sizeof(VAConfigAttrib));
> +    ASSERT(attrib_list);
>  
>      config_count = 0;
>      for(i = 0; i < num_profiles; i++)
> diff --git a/test/basic/test_09.c b/test/basic/test_09.c
> index 0decc06..897d6fc 100644
> --- a/test/basic/test_09.c
> +++ b/test/basic/test_09.c
> @@ -44,7 +44,9 @@ void test()
>      ASSERT(entrypoints);
>  
>      VAConfigID *configs = malloc(max_entrypoints * num_profiles *
> sizeof(VAConfigID));
> +    ASSERT(configs);
>      VAContextID *contexts = malloc(max_entrypoints * num_profiles *
> sizeof(VAContextID));
> +    ASSERT(contexts);
>  
>      for(i = 0; i < num_profiles; i++)
>      {
> @@ -67,6 +69,7 @@ void test()
>      int total_surfaces = config_count * surface_count;
>      
>      VASurfaceID *surfaces = malloc(total_surfaces *
> sizeof(VASurfaceID));
> +    ASSERT(surfaces);
>  
>      // TODO: Don't assume VA_RT_FORMAT_YUV420 is supported / needed
> for each config
>      va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, width,
> height, surfaces, total_surfaces, NULL, 0);
> diff --git a/test/basic/test_10.c b/test/basic/test_10.c
> index 9c7c566..e79debc 100644
> --- a/test/basic/test_10.c
> +++ b/test/basic/test_10.c
> @@ -45,6 +45,7 @@ void pre()
>      total_surfaces = surface_count;
>      
>      surfaces = malloc(total_surfaces * sizeof(VASurfaceID));
> +    assert(surfaces);
>  
>      // TODO: Don't assume VA_RT_FORMAT_YUV420 is supported / needed
> for each config
>      va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, width,
> height, surfaces, total_surfaces, NULL, 0);
> diff --git a/test/basic/test_11.c b/test/basic/test_11.c
> index 99c8785..143d084 100644
> --- a/test/basic/test_11.c
> +++ b/test/basic/test_11.c
> @@ -45,6 +45,7 @@ void pre()
>      total_surfaces = surface_count;
>      
>      surfaces = malloc(total_surfaces * sizeof(VASurfaceID));
> +    assert(surfaces);
>  
>      // TODO: Don't assume VA_RT_FORMAT_YUV420 is supported / needed
> for each config
>      va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, width,
> height, surfaces, total_surfaces, NULL, 0);


More information about the Libva mailing list