public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Matthew Bobrowski via ltp <ltp@lists.linux.it>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, LTP List <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v2 2/2] syscalls/fanotify21: add new test checking the returned pidfd from fanotify in FAN_REPORT_PIDFD mode
Date: Tue, 9 Nov 2021 20:36:02 +1100	[thread overview]
Message-ID: <YYpBAlufyR0nlI7S@google.com> (raw)
In-Reply-To: <CAOQ4uxgphXO16-u2fsm9Ts4nxY3AzSPpyMbKMWb2AtWs2ASB7Q@mail.gmail.com>

On Fri, Nov 05, 2021 at 06:21:56AM +0200, Amir Goldstein wrote:
> > +next_event:
> > +               i += event->event_len;
> > +               if (event->fd >= 0)
> > +                       SAFE_CLOSE(event->fd);
> > +
> > +               if (info && info->pidfd >= 0)
> > +                       SAFE_CLOSE(info->pidfd);
> > +
> > +               if (event_pidfd_fdinfo)
> > +                       free(event_pidfd_fdinfo);
> 
> Need to reset event_pidfd_fdinfo = NULL
> to avoid double free in do_cleanup

But, the variable event_pidfd_fdinfo is not referenced nor is visible
outside the scope of the do_test() function and therefore no double
free would occur, right?

> > +       }
> > +}
> > +
> > +static void do_cleanup(void)
> > +{
> > +       if (fanotify_fd >= 0)
> > +               SAFE_CLOSE(fanotify_fd);
> > +
> > +       if (self_pidfd_fdinfo)
> > +               free(self_pidfd_fdinfo);

Variables self_pidfd_fdinfo do_cleanup() and event_pidfd_fdinfo
do_test() are different.

/M

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2021-11-09  9:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 10:57 [LTP] [PATCH v2 0/2] Test support for new fanotify FAN_REPORT_PIDFD feature Matthew Bobrowski via ltp
2021-11-02 10:57 ` [LTP] [PATCH v2 1/2] syscalls/fanotify20: add new test for FAN_REPORT_PIDFD Matthew Bobrowski via ltp
2021-11-02 11:02   ` Amir Goldstein
2021-11-02 11:15     ` Matthew Bobrowski via ltp
2021-11-02 12:15       ` Amir Goldstein
2021-11-05  3:03         ` Matthew Bobrowski via ltp
2021-11-02 10:57 ` [LTP] [PATCH v2 2/2] syscalls/fanotify21: add new test checking the returned pidfd from fanotify in FAN_REPORT_PIDFD mode Matthew Bobrowski via ltp
2021-11-05  4:21   ` Amir Goldstein
2021-11-09  9:36     ` Matthew Bobrowski via ltp [this message]
2021-11-09 10:34       ` Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YYpBAlufyR0nlI7S@google.com \
    --to=ltp@lists.linux.it \
    --cc=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --cc=repnop@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox