[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH 3/5] libcacard/vscclient: fix leakage of socke
From: |
Michael Tokarev |
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 |
User-agent: |
Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/17.0 Icedove/17.0 |
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
- [Qemu-trivial] [PATCH 1/5] oslib-posix: add qemu_pipe_non_block, Alon Levy, 2013/06/04
- [Qemu-trivial] [PATCH 3/5] libcacard/vscclient: fix leakage of socket on error paths, Alon Levy, 2013/06/04
- [Qemu-trivial] [PATCH 4/5] libcacard/vreader.c: fix possible NULL dereference, Alon Levy, 2013/06/04
- [Qemu-trivial] [PATCH 5/5] libcacard/vscclient.c: fix use of uninitialized variable, Alon Levy, 2013/06/04
- Re: [Qemu-trivial] [Qemu-devel] [PATCH 1/5] oslib-posix: add qemu_pipe_non_block, Peter Maydell, 2013/06/04
- Re: [Qemu-trivial] [Qemu-devel] [PATCH 1/5] oslib-posix: add qemu_pipe_non_block, Eric Blake, 2013/06/04
- Re: [Qemu-trivial] [PATCH 1/5] oslib-posix: add qemu_pipe_non_block, Michael Tokarev, 2013/06/05
- Re: [Qemu-trivial] [PATCH 1/5] oslib-posix: add qemu_pipe_non_block, Michael Tokarev, 2013/06/12