[Mesa-dev] [PATCH 2/4] intel/decoder: Avoid freeing invalid pointer

Lionel Landwerlin lionel.g.landwerlin at intel.com
Wed Sep 5 17:29:38 UTC 2018


On 05/09/2018 18:19, Sagar Ghuge wrote:
> Signed-off-by: Sagar Ghuge <sagar.ghuge at intel.com>
> ---
>   src/intel/common/gen_decoder.c | 4 ----
>   1 file changed, 4 deletions(-)
>
> diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
> index dbd060d53c..c44b8f060d 100644
> --- a/src/intel/common/gen_decoder.c
> +++ b/src/intel/common/gen_decoder.c
> @@ -662,8 +662,6 @@ gen_spec_load_from_path(const struct gen_device_info *devinfo,
>         len = fread(buf, 1, XML_BUFFER_SIZE, input);
>         if (len == 0) {
>            fprintf(stderr, "fread: %m\n");
> -         free(ctx.spec);
> -         ctx.spec = NULL;
>            goto end;
>         }
>         if (XML_ParseBuffer(ctx.parser, len, len == 0) == 0) {
> @@ -672,8 +670,6 @@ gen_spec_load_from_path(const struct gen_device_info *devinfo,
>                    XML_GetCurrentLineNumber(ctx.parser),
>                    XML_GetCurrentColumnNumber(ctx.parser),
>                    XML_ErrorString(XML_GetErrorCode(ctx.parser)));
> -         free(ctx.spec);
> -         ctx.spec = NULL;
>            goto end;
>         }
>      } while (len > 0);

Looks good but we're still missing a ralloc_free(ctx.spec) after the end 
label.



More information about the mesa-dev mailing list