From: Michael Tokarev <mjt@tls.msk.ru>
To: Alon Levy <alevy@redhat.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH 3/5] libcacard/vscclient: fix leakage of socket on error paths
Date: Wed, 12 Jun 2013 16:09:50 +0400 [thread overview]
Message-ID: <51B8650E.7080703@msgid.tls.msk.ru> (raw)
In-Reply-To: <1370377419-31788-3-git-send-email-alevy@redhat.com>
05.06.2013 00:23, Alon Levy wrote:
> --- a/libcacard/vscclient.c
> +++ b/libcacard/vscclient.c
> @@ -759,5 +763,6 @@ main(
> g_io_channel_unref(channel_socket);
> g_byte_array_unref(socket_to_send);
>
> + closesocket(sock);
> return 0;
> }
This one isn't really needed, -- there's no need to close
filedescriptors at the end of main(). I understand the
memory unref/free calls above it, to make valgrind and
glib trackers happy. But it ofcourse does not hurt.
Besides, in all these error places it'd be really nice
to print the actual cause of the problem too - like
strerror(errno) or something like that. Unfortunately we
had too many of these already in all parts of the code,
and it really is sometimes difficult to understand WHY
it fails without seeing the actual cause. I'll send a
separate patch for that.
Thanks, applied to the trivial patches queue.
/mjt
WARNING: multiple messages have this Message-ID (diff)
From: Michael Tokarev <mjt@tls.msk.ru>
To: Alon Levy <alevy@redhat.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH 3/5] libcacard/vscclient: fix leakage of socket on error paths
Date: Wed, 12 Jun 2013 16:09:50 +0400 [thread overview]
Message-ID: <51B8650E.7080703@msgid.tls.msk.ru> (raw)
In-Reply-To: <1370377419-31788-3-git-send-email-alevy@redhat.com>
05.06.2013 00:23, Alon Levy wrote:
> --- a/libcacard/vscclient.c
> +++ b/libcacard/vscclient.c
> @@ -759,5 +763,6 @@ main(
> g_io_channel_unref(channel_socket);
> g_byte_array_unref(socket_to_send);
>
> + closesocket(sock);
> return 0;
> }
This one isn't really needed, -- there's no need to close
filedescriptors at the end of main(). I understand the
memory unref/free calls above it, to make valgrind and
glib trackers happy. But it ofcourse does not hurt.
Besides, in all these error places it'd be really nice
to print the actual cause of the problem too - like
strerror(errno) or something like that. Unfortunately we
had too many of these already in all parts of the code,
and it really is sometimes difficult to understand WHY
it fails without seeing the actual cause. I'll send a
separate patch for that.
Thanks, applied to the trivial patches queue.
/mjt
next prev parent reply other threads:[~2013-06-12 12:10 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-04 20:23 [Qemu-trivial] [PATCH 1/5] oslib-posix: add qemu_pipe_non_block Alon Levy
2013-06-04 20:23 ` [Qemu-devel] " Alon Levy
2013-06-04 20:23 ` [Qemu-trivial] [PATCH 2/5] use qemu_pipe_non_block Alon Levy
2013-06-04 20:23 ` [Qemu-devel] " Alon Levy
2013-06-04 20:47 ` [Qemu-trivial] " Paolo Bonzini
2013-06-04 20:47 ` [Qemu-devel] " Paolo Bonzini
2013-06-04 20:59 ` [Qemu-trivial] " Alon Levy
2013-06-04 20:59 ` Alon Levy
2013-06-04 21:08 ` [Qemu-trivial] " Peter Maydell
2013-06-04 21:08 ` Peter Maydell
2013-06-04 20:50 ` [Qemu-trivial] " Peter Maydell
2013-06-04 20:50 ` Peter Maydell
2013-06-04 20:56 ` [Qemu-trivial] " Alon Levy
2013-06-04 20:56 ` Alon Levy
2013-06-04 20:23 ` [Qemu-trivial] [PATCH 3/5] libcacard/vscclient: fix leakage of socket on error paths Alon Levy
2013-06-04 20:23 ` [Qemu-devel] " Alon Levy
2013-06-04 20:55 ` [Qemu-trivial] " Peter Maydell
2013-06-04 20:55 ` Peter Maydell
2013-06-12 12:09 ` Michael Tokarev [this message]
2013-06-12 12:09 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-06-04 20:23 ` [Qemu-trivial] [PATCH 4/5] libcacard/vreader.c: fix possible NULL dereference Alon Levy
2013-06-04 20:23 ` [Qemu-devel] " Alon Levy
2013-06-04 21:06 ` [Qemu-trivial] " Peter Maydell
2013-06-04 21:06 ` Peter Maydell
2013-06-04 20:23 ` [Qemu-trivial] [PATCH 5/5] libcacard/vscclient.c: fix use of uninitialized variable Alon Levy
2013-06-04 20:23 ` [Qemu-devel] " Alon Levy
2013-06-04 21:12 ` [Qemu-trivial] " Peter Maydell
2013-06-04 21:12 ` Peter Maydell
2013-06-04 20:48 ` [Qemu-trivial] [Qemu-devel] [PATCH 1/5] oslib-posix: add qemu_pipe_non_block Peter Maydell
2013-06-04 20:48 ` Peter Maydell
2013-06-04 21:11 ` [Qemu-trivial] " Eric Blake
2013-06-04 21:11 ` Eric Blake
2013-06-04 21:41 ` [Qemu-trivial] " Alon Levy
2013-06-04 21:41 ` Alon Levy
2013-06-05 19:43 ` [Qemu-trivial] " Michael Tokarev
2013-06-05 19:43 ` [Qemu-devel] " Michael Tokarev
2013-06-12 9:38 ` Michael Tokarev
2013-06-12 9:38 ` [Qemu-devel] " Michael Tokarev
2013-06-12 11:21 ` [Qemu-trivial] [Qemu-devel] " Alon Levy
2013-06-12 11:21 ` [Qemu-devel] [Qemu-trivial] " Alon Levy
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=51B8650E.7080703@msgid.tls.msk.ru \
--to=mjt@tls.msk.ru \
--cc=alevy@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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.