Skip to contentSkip to conversation

test-qga: fix a resource leak in test_qga_guest_get_osinfo()

PATCH In review Alex Chen 3 participants 3 messages Nov 25, 2020 – Nov 26, 2020

lore
Share & tools
lore

Alex Chen

author
#0 lore raw

PATCH 1/1 test-qga: fix a resource leak in test_qga_guest_get_osinfo()

The fixture->fd is created in fixture_setup() and, likewise, needs to be closed in fixture_tear_down().

---
 tests/test-qga.c | 1 +
 1 file changed, 1 insertion(+)
tests/test-qga.c +1 -0
index c1b173b3cb..eb33264e8e 100644
@@ -111,6 +111,7 @@ fixture_tear_down(TestFixture *fixture, gconstpointer data)
 
     g_rmdir(fixture->test_dir);
     g_free(fixture->test_dir);
+    close(fixture->fd);
 }
 
 static void qmp_assertion_message_error(const char     *domain,
Signature · 1 line
2.19.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Alex Chen

The fixture->fd is created in fixture_setup() and, likewise, needs to be closed
in fixture_tear_down().

---

Quoted 21 lines
 tests/test-qga.c | 1 +
 1 file changed, 1 insertion(+)
tests/test-qga.c +1 -0
index c1b173b3cb..eb33264e8e 100644
@@ -111,6 +111,7 @@ fixture_tear_down(TestFixture *fixture, gconstpointer
 data)
 
     g_rmdir(fixture->test_dir);
     g_free(fixture->test_dir);
+    close(fixture->fd);
 }
 

static void qmp_assertion_message_error(const char *domain,
--
2.19.1

Signature · 1 line
Marc-André Lureau
Reviewed-by on v1 1/1
#2 lore raw
In reply to Alex Chen
Quoted 6 lines · Alex Chen <[email protected]> 于2020年11月25日周三 下午6:37写道:

The fixture->fd is created in fixture_setup() and, likewise, needs to be closed in fixture_tear_down().

Quoted 20 lines
---
 tests/test-qga.c | 1 +
 1 file changed, 1 insertion(+)
tests/test-qga.c +1 -1
index c1b173b3cb..eb33264e8e 100644
@@ -111,6 +111,7 @@ fixture_tear_down(TestFixture *fixture, gconstpointer data)
 
     g_rmdir(fixture->test_dir);
     g_free(fixture->test_dir);
+    close(fixture->fd);
 }
 
 static void qmp_assertion_message_error(const char     *domain,
--

2.19.1