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

Alex Chen posted 1 patch 3 years, 5 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20201125102403.57709-1-alex.chen@huawei.com
Maintainers: Michael Roth <mdroth@linux.vnet.ibm.com>
tests/test-qga.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] test-qga: fix a resource leak in test_qga_guest_get_osinfo()
Posted by Alex Chen 3 years, 5 months ago
The fixture->fd is created in fixture_setup() and, likewise, needs to be closed
in fixture_tear_down().

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
 tests/test-qga.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/test-qga.c b/tests/test-qga.c
index c1b173b3cb..eb33264e8e 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -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


Re: [PATCH] test-qga: fix a resource leak in test_qga_guest_get_osinfo()
Posted by Marc-André Lureau 3 years, 5 months ago
On Wed, Nov 25, 2020 at 2:37 PM Alex Chen <alex.chen@huawei.com> wrote:

> The fixture->fd is created in fixture_setup() and, likewise, needs to be
> closed
> in fixture_tear_down().
>
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Alex Chen <alex.chen@huawei.com>
>


Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  tests/test-qga.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tests/test-qga.c b/tests/test-qga.c
> index c1b173b3cb..eb33264e8e 100644
> --- a/tests/test-qga.c
> +++ b/tests/test-qga.c
> @@ -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
>
>
>

-- 
Marc-André Lureau
Re: [PATCH] test-qga: fix a resource leak in test_qga_guest_get_osinfo()
Posted by Li Qiang 3 years, 5 months ago
Alex Chen <alex.chen@huawei.com> 于2020年11月25日周三 下午6:37写道:
>
> The fixture->fd is created in fixture_setup() and, likewise, needs to be closed
> in fixture_tear_down().
>
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Alex Chen <alex.chen@huawei.com>

Reviewed-by: Li Qiang <liq3ea@gmail.com>

> ---
>  tests/test-qga.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tests/test-qga.c b/tests/test-qga.c
> index c1b173b3cb..eb33264e8e 100644
> --- a/tests/test-qga.c
> +++ b/tests/test-qga.c
> @@ -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
>
>