diff mbox series

vhost-user-test: fix leaks

Message ID 20190305225135.7060-1-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show
Series vhost-user-test: fix leaks | expand

Commit Message

Marc-André Lureau March 5, 2019, 10:51 p.m. UTC
Spotted by ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/vhost-user-test.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Thomas Huth March 6, 2019, 6:35 a.m. UTC | #1
On 05/03/2019 23.51, Marc-André Lureau wrote:
> Spotted by ASAN.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  tests/vhost-user-test.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
> index 4cd0a97f13..9364227ba4 100644
> --- a/tests/vhost-user-test.c
> +++ b/tests/vhost-user-test.c
> @@ -588,6 +588,7 @@ static void test_server_free(TestServer *server)
>          g_test_message("unable to rmdir: path (%s): %s",
>                         server->tmpfs, strerror(errno));
>      }
> +    g_free(server->tmpfs);
>  
>      qemu_chr_fe_deinit(&server->chr, true);
>  
> @@ -605,6 +606,8 @@ static void test_server_free(TestServer *server)
>  
>      g_main_loop_unref(server->loop);
>      g_main_context_unref(server->context);
> +    g_cond_clear(&server->data_cond);
> +    g_mutex_clear(&server->data_mutex);
>      g_free(server);
>  }

Reviewed-by: Thomas Huth <thuth@redhat.com>

... and queued to my qtest-next branch (unless Michael wants to take it
through hist vhost tree instead).
Stefano Garzarella March 6, 2019, 9:08 a.m. UTC | #2
On Tue, Mar 05, 2019 at 11:51:35PM +0100, Marc-André Lureau wrote:
> Spotted by ASAN.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  tests/vhost-user-test.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

Thanks,
Stefano
Philippe Mathieu-Daudé March 6, 2019, 9:28 a.m. UTC | #3
On 3/5/19 11:51 PM, Marc-André Lureau wrote:
> Spotted by ASAN.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  tests/vhost-user-test.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
> index 4cd0a97f13..9364227ba4 100644
> --- a/tests/vhost-user-test.c
> +++ b/tests/vhost-user-test.c
> @@ -588,6 +588,7 @@ static void test_server_free(TestServer *server)
>          g_test_message("unable to rmdir: path (%s): %s",
>                         server->tmpfs, strerror(errno));
>      }
> +    g_free(server->tmpfs);

Fixes: ae31fb54914 and 4d3f50eb489
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>  
>      qemu_chr_fe_deinit(&server->chr, true);
>  
> @@ -605,6 +606,8 @@ static void test_server_free(TestServer *server)
>  
>      g_main_loop_unref(server->loop);
>      g_main_context_unref(server->context);
> +    g_cond_clear(&server->data_cond);
> +    g_mutex_clear(&server->data_mutex);
>      g_free(server);
>  }
>  
>
Michael S. Tsirkin March 6, 2019, 2:17 p.m. UTC | #4
On Wed, Mar 06, 2019 at 07:35:28AM +0100, Thomas Huth wrote:
> On 05/03/2019 23.51, Marc-André Lureau wrote:
> > Spotted by ASAN.
> > 
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  tests/vhost-user-test.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
> > index 4cd0a97f13..9364227ba4 100644
> > --- a/tests/vhost-user-test.c
> > +++ b/tests/vhost-user-test.c
> > @@ -588,6 +588,7 @@ static void test_server_free(TestServer *server)
> >          g_test_message("unable to rmdir: path (%s): %s",
> >                         server->tmpfs, strerror(errno));
> >      }
> > +    g_free(server->tmpfs);
> >  
> >      qemu_chr_fe_deinit(&server->chr, true);
> >  
> > @@ -605,6 +606,8 @@ static void test_server_free(TestServer *server)
> >  
> >      g_main_loop_unref(server->loop);
> >      g_main_context_unref(server->context);
> > +    g_cond_clear(&server->data_cond);
> > +    g_mutex_clear(&server->data_mutex);
> >      g_free(server);
> >  }
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> 
> ... and queued to my qtest-next branch (unless Michael wants to take it
> through hist vhost tree instead).

No it's fine.

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
diff mbox series

Patch

diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 4cd0a97f13..9364227ba4 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -588,6 +588,7 @@  static void test_server_free(TestServer *server)
         g_test_message("unable to rmdir: path (%s): %s",
                        server->tmpfs, strerror(errno));
     }
+    g_free(server->tmpfs);
 
     qemu_chr_fe_deinit(&server->chr, true);
 
@@ -605,6 +606,8 @@  static void test_server_free(TestServer *server)
 
     g_main_loop_unref(server->loop);
     g_main_context_unref(server->context);
+    g_cond_clear(&server->data_cond);
+    g_mutex_clear(&server->data_mutex);
     g_free(server);
 }