[Piglit] [PATCH] cl-api-get-platform-ids: Fix possible use after free.

Jan Vesely jan.vesely at rutgers.edu
Wed Dec 17 07:00:28 PST 2014


On Tue, 2014-12-16 at 22:27 -0800, Vinson Lee wrote:
> Fixes "Use after free" defect reported by Coverity.
> 
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  tests/cl/api/get-platform-ids.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tests/cl/api/get-platform-ids.c b/tests/cl/api/get-platform-ids.c
> index 6cc734a..ab3e4cd 100644
> --- a/tests/cl/api/get-platform-ids.c
> +++ b/tests/cl/api/get-platform-ids.c
> @@ -80,6 +80,7 @@ piglit_cl_test(const int argc,
>  				piglit_merge_result(&result, PIGLIT_FAIL);
>  			}
>  			free(platforms);
> +			platforms = NULL;

The next test relies on the fact that platforms is not NULL. Maybe we
can use something like (void*)-1 instead of freed pointer.


>  		}
>  	}
>  	

-- 
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20141217/152c7388/attachment.sig>


More information about the Piglit mailing list