All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Cong Liu <liucong2@kylinos.cn>
Cc: Alexandre Iooss <erdnaxe@crans.org>,
	Mahmoud Mandour <ma.mandourr@gmail.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH] contrib/plugins: Close file descriptor on connect failure
Date: Mon, 23 Oct 2023 14:44:36 +0100	[thread overview]
Message-ID: <87r0ll4fna.fsf@linaro.org> (raw)
In-Reply-To: <20231016093143.222551-1-liucong2@kylinos.cn>


Cong Liu <liucong2@kylinos.cn> writes:

> This patch closes the file descriptor fd on connect failure to avoid
> resource leak.
>
> Signed-off-by: Cong Liu <liucong2@kylinos.cn>
> ---
>  contrib/plugins/lockstep.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c
> index f0cb8792c6fa..3c0f2b485181 100644
> --- a/contrib/plugins/lockstep.c
> +++ b/contrib/plugins/lockstep.c
> @@ -303,6 +303,7 @@ static bool connect_socket(const char *path)
>      sockaddr.sun_family = AF_UNIX;
>      if (g_strlcpy(sockaddr.sun_path, path, pathlen) >= pathlen) {
>          perror("bad path");
> +        close(fd);
>          return false;
>      }

Queued to plugins/next, thanks.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


      parent reply	other threads:[~2023-10-23 13:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16  9:31 [PATCH] contrib/plugins: Close file descriptor on connect failure Cong Liu
2023-10-18  2:52 ` [PATCH v2] contrib/plugins: Close file descriptor on error return Cong Liu
2023-10-23 13:45   ` Alex Bennée
2023-10-23 13:44 ` Alex Bennée [this message]

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=87r0ll4fna.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=erdnaxe@crans.org \
    --cc=liucong2@kylinos.cn \
    --cc=ma.mandourr@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.