[LTP] [PATCH v2 2/2] syscalls/fanotify21: add new test checking the returned pidfd from fanotify in FAN_REPORT_PIDFD mode

Amir Goldstein amir73il@gmail.com
Fri Nov 5 05:21:56 CET 2021


> +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

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

Thanks,
Amir.


More information about the ltp mailing list