Patchwork [1/2] libqtest: Plug fd and memory leaks in qtest_quit()

login
register
mail settings
Submitter Markus Armbruster
Date June 19, 2013, 7:44 a.m.
Message ID <1371627895-27046-2-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/252511/
State New
Headers show

Comments

Markus Armbruster - June 19, 2013, 7:44 a.m.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 tests/libqtest.c | 4 ++++
 1 file changed, 4 insertions(+)
Anthony Liguori - June 19, 2013, 12:30 p.m.
Markus Armbruster <armbru@redhat.com> writes:

> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
>  tests/libqtest.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/tests/libqtest.c b/tests/libqtest.c
> index 879ffe9..bb82069 100644
> --- a/tests/libqtest.c
> +++ b/tests/libqtest.c
> @@ -171,12 +171,16 @@ void qtest_quit(QTestState *s)
>          waitpid(pid, &status, 0);
>      }
>  
> +    close(s->fd);
> +    close(s->qmp_fd);
> +    g_string_free(s->rx, true);
>      unlink(s->pid_file);
>      unlink(s->socket_path);
>      unlink(s->qmp_socket_path);
>      g_free(s->pid_file);
>      g_free(s->socket_path);
>      g_free(s->qmp_socket_path);
> +    g_free(s);
>  }
>  
>  static void socket_sendf(int fd, const char *fmt, va_list ap)
> -- 
> 1.7.11.7
Anthony Liguori - June 19, 2013, 12:31 p.m.
Markus Armbruster <armbru@redhat.com> writes:

> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
>  tests/libqtest.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/tests/libqtest.c b/tests/libqtest.c
> index 879ffe9..bb82069 100644
> --- a/tests/libqtest.c
> +++ b/tests/libqtest.c
> @@ -171,12 +171,16 @@ void qtest_quit(QTestState *s)
>          waitpid(pid, &status, 0);
>      }
>  
> +    close(s->fd);
> +    close(s->qmp_fd);
> +    g_string_free(s->rx, true);
>      unlink(s->pid_file);
>      unlink(s->socket_path);
>      unlink(s->qmp_socket_path);
>      g_free(s->pid_file);
>      g_free(s->socket_path);
>      g_free(s->qmp_socket_path);
> +    g_free(s);
>  }
>  
>  static void socket_sendf(int fd, const char *fmt, va_list ap)
> -- 
> 1.7.11.7

Patch

diff --git a/tests/libqtest.c b/tests/libqtest.c
index 879ffe9..bb82069 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -171,12 +171,16 @@  void qtest_quit(QTestState *s)
         waitpid(pid, &status, 0);
     }
 
+    close(s->fd);
+    close(s->qmp_fd);
+    g_string_free(s->rx, true);
     unlink(s->pid_file);
     unlink(s->socket_path);
     unlink(s->qmp_socket_path);
     g_free(s->pid_file);
     g_free(s->socket_path);
     g_free(s->qmp_socket_path);
+    g_free(s);
 }
 
 static void socket_sendf(int fd, const char *fmt, va_list ap)