diff mbox

[v3] tests: fix small leak in test-io-channel-command

Message ID 20160906133637.32147-1-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau Sept. 6, 2016, 1:36 p.m. UTC
srcfifo && dstfifo must still be freed if socat is not present.

Only unlink if the fifo was actually created.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/test-io-channel-command.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Daniel P. Berrangé Sept. 6, 2016, 1:44 p.m. UTC | #1
On Tue, Sep 06, 2016 at 05:36:37PM +0400, Marc-André Lureau wrote:
> srcfifo && dstfifo must still be freed if socat is not present.
> 
> Only unlink if the fifo was actually created.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  tests/test-io-channel-command.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>

I'll add this to my I/O queue unless you respin your current PULL request
with this included.

Regards,
Daniel
diff mbox

Patch

diff --git a/tests/test-io-channel-command.c b/tests/test-io-channel-command.c
index 1d1f461..4fc1732 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 (mkfifo(TEST_FIFO, 0600) < 0) {
         abort();
@@ -59,9 +59,11 @@  static void test_io_channel_command_fifo(bool async)
     object_unref(OBJECT(src));
     object_unref(OBJECT(dst));
 
+    unlink(TEST_FIFO);
+
+end:
     g_free(srcfifo);
     g_free(dstfifo);
-    unlink(TEST_FIFO);
 }