[Piglit] [PATCH 1/3] cl: Don't use variable length array
Jose Fonseca
jfonseca at vmware.com
Fri Feb 20 04:02:33 PST 2015
On 12/12/14 19:33, Jan Vesely wrote:
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
> tests/cl/program/program-tester.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tests/cl/program/program-tester.c b/tests/cl/program/program-tester.c
> index d6dbc55..3905679 100644
> --- a/tests/cl/program/program-tester.c
> +++ b/tests/cl/program/program-tester.c
> @@ -517,13 +517,15 @@ regex_get_str(char** dst,
> unsigned int index,
> int cflags)
> {
> - regmatch_t pmatch[index+1];
> + regmatch_t *pmatch = calloc(index+1, sizeof(*pmatch));
> + bool ret = false;
>
> if(regex_get_matches(src, pattern, pmatch, index+1, cflags)) {
> - return regex_get_match_str(dst, src, pmatch, index);
> + ret = regex_get_match_str(dst, src, pmatch, index);
> }
>
> - return false;
> + free(pmatch);
> + return ret;
> }
>
> bool
>
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>
More information about the Piglit
mailing list