[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 11/37] tests: fix small leak in test-io-channel-
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 11/37] tests: fix small leak in test-io-channel-command |
Date: |
Tue, 19 Jul 2016 15:04:07 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 07/19/2016 02:54 AM, address@hidden wrote:
> From: Marc-André Lureau <address@hidden>
>
> srcfifo && dstfifo must still be freed in this case.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> tests/test-io-channel-command.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tests/test-io-channel-command.c b/tests/test-io-channel-command.c
> index 1d1f461..95be370 100644
> --- a/tests/test-io-channel-command.c
> +++ b/tests/test-io-channel-command.c
> @@ -40,7 +40,7 @@ static void test_io_channel_command_fifo(bool async)
>
> unlink(TEST_FIFO);
> if (access("/bin/socat", X_OK) < 0) {
> - return; /* Pretend success if socat is not present */
> + goto end; /* Pretend success if socat is not present */
> }
If we fail here...
> if (mkfifo(TEST_FIFO, 0600) < 0) {
...then we don't create a fifo here...
> abort();
> @@ -59,6 +59,7 @@ static void test_io_channel_command_fifo(bool async)
> object_unref(OBJECT(src));
> object_unref(OBJECT(dst));
>
> +end:
> g_free(srcfifo);
> g_free(dstfifo);
> unlink(TEST_FIFO);
...and unlink() will (hopefully) fail to unlink a missing file. But in
the worst case, it unlinks someone else's file. Probably worth being a
bit stricter about only undoing what you have already done.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH 06/37] tests: fix test-vmstate leaks, (continued)
- [Qemu-devel] [PATCH 07/37] tests: fix test-iov leaks, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 08/37] qdist: fix entries memory leak, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 09/37] tests: fix check-qom-interface leaks, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 10/37] tests: fix check-qom-proplist leaks, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 11/37] tests: fix small leak in test-io-channel-command, marcandre . lureau, 2016/07/19
- Re: [Qemu-devel] [PATCH 11/37] tests: fix small leak in test-io-channel-command,
Eric Blake <=
- [Qemu-devel] [PATCH 12/37] tests: fix leak in test-string-input-visitor, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 13/37] portio: keep references on portio, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 15/37] pc: simplify passing qemu_irq, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 14/37] numa: do not leak NumaOptions, marcandre . lureau, 2016/07/19
- [Qemu-devel] [PATCH 16/37] pc: don't leak a20_line, marcandre . lureau, 2016/07/19