Re: [PATCH] fix double free issue in event_read_print_args

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 28 Jun 2024 09:51:10 +0800
Totoro W <tw19881113@xxxxxxxxx> wrote:

> Oops, missing the patch part, here it is:

Could you send a v2 with all the contents.

Thanks,

-- Steve

> 
> diff --git a/src/event-parse.c b/src/event-parse.c
> index 9f0522c..1f51ee9 100644
> --- a/src/event-parse.c
> +++ b/src/event-parse.c
> @@ -2375,8 +2375,6 @@ process_op(struct tep_event *event, struct
> tep_print_arg *arg, char **tok)
> 
>                 /* it will set arg->op.right */
>                 type = process_cond(event, arg, tok);
> -               if (type == TEP_EVENT_ERROR)
> -                       free(token);
> 
>         } else if (strcmp(token, ">>") == 0 ||
>                    strcmp(token, "<<") == 0 ||
> @@ -3787,7 +3785,7 @@ static int event_read_print_args(struct
> tep_event *event, struct tep_print_arg *
>  {
>         enum tep_event_type type = TEP_EVENT_ERROR;
>         struct tep_print_arg *arg;
> -       char *token;
> +       char *token = NULL;
>         int args = 0;
> 
>         do {
> @@ -3817,6 +3815,7 @@ static int event_read_print_args(struct
> tep_event *event, struct tep_print_arg *
>                 if (type == TEP_EVENT_OP) {
>                         type = process_op(event, arg, &token);
>                         free_token(token);
> +                       token = NULL;
> 
>                         if (consolidate_op_arg(arg) < 0)
>                                 type = TEP_EVENT_ERROR;





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux