Skip to contentSkip to conversation

tests: fix small leak in test-io-channel-command

PATCH In review Marc-André Lureau 3 participants 3 messages Sep 6, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 tests: fix small leak in test-io-channel-command

srcfifo && dstfifo must still be freed if socat is not present.

Only unlink if the fifo was actually created.

---
 tests/test-io-channel-command.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/test-io-channel-command.c +4 -2
index 1d1f461..4fc1732 100644
@@ -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);
 }
 
 
Signature · 1 line
2.10.0
#1 lore raw
Quoted 8 lines · Marc-André Lureau

srcfifo && dstfifo must still be freed if socat is not present.

Only unlink if the fifo was actually created.

---
 tests/test-io-channel-command.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#2 lore raw

Hi

----- Original Message -----

Quoted 10 lines · Marc-André Lureau
Quoted 8 lines

srcfifo && dstfifo must still be freed if socat is not present.

Only unlink if the fifo was actually created.

---
 tests/test-io-channel-command.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Quoted 4 lines

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

I don't know what's best. Peter, should I send a new pull request with the new patch? Or send a new one without it? Or you can pull the current request without this patch?

thanks

Quoted 9 lines

Regards,
Daniel
--

|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|