[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.7 v3 04/36] qga: free remaining leaking st
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH for-2.7 v3 04/36] qga: free remaining leaking state |
Date: |
Thu, 04 Aug 2016 15:38:32 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Copying the QGA maintainer.
address@hidden writes:
> From: Marc-André Lureau <address@hidden>
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> qga/guest-agent-command-state.c | 7 +++++++
> qga/guest-agent-core.h | 1 +
> qga/main.c | 6 ++++++
> 3 files changed, 14 insertions(+)
>
> diff --git a/qga/guest-agent-command-state.c b/qga/guest-agent-command-state.c
> index 4de229c..31c6368 100644
> --- a/qga/guest-agent-command-state.c
> +++ b/qga/guest-agent-command-state.c
> @@ -71,3 +71,10 @@ GACommandState *ga_command_state_new(void)
> cs->groups = NULL;
> return cs;
> }
> +
> +void ga_command_state_free(GACommandState *cs)
> +{
> + g_slist_foreach(cs->groups, qemu_g_func_free, NULL);
> + g_slist_free(cs->groups);
Remarks on g_list_free_full() in PATCH 03 apply to g_slist_free_full()
here.
> + g_free(cs);
> +}
> diff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h
> index 0a49516..63e9d39 100644
> --- a/qga/guest-agent-core.h
> +++ b/qga/guest-agent-core.h
> @@ -28,6 +28,7 @@ void ga_command_state_add(GACommandState *cs,
> void ga_command_state_init_all(GACommandState *cs);
> void ga_command_state_cleanup_all(GACommandState *cs);
> GACommandState *ga_command_state_new(void);
> +void ga_command_state_free(GACommandState *cs);
> bool ga_logging_enabled(GAState *s);
> void ga_disable_logging(GAState *s);
> void ga_enable_logging(GAState *s);
> diff --git a/qga/main.c b/qga/main.c
> index 868508b..0038702 100644
> --- a/qga/main.c
> +++ b/qga/main.c
> @@ -1372,6 +1372,8 @@ int main(int argc, char **argv)
> end:
> if (s->command_state) {
> ga_command_state_cleanup_all(s->command_state);
> + ga_command_state_free(s->command_state);
> + json_message_parser_destroy(&s->parser);
> }
> if (s->channel) {
> ga_channel_free(s->channel);
> @@ -1384,6 +1386,10 @@ end:
> }
>
> config_free(config);
> + if (s->main_loop) {
> + g_main_loop_unref(s->main_loop);
> + }
> + g_free(s);
>
> return ret;
> }
Not bothering to free memory immediately before terminating the process
is not a leak. The commit message shouldn't claim it is.
Personally, I wouldn't bother with freeing memory there. Applies to
PATCH 03, too. But it looks like the maintainer likes having it done.
If that's true, then doing it completely is probably better.
Leaving actual review to the maintainer.
- [Qemu-devel] [PATCH for-2.7 v3 01/36] build-sys: fix building with make CFLAGS=.. argument, (continued)
- [Qemu-devel] [PATCH for-2.7 v3 01/36] build-sys: fix building with make CFLAGS=.. argument, marcandre . lureau, 2016/08/03
- [Qemu-devel] [PATCH for-2.7 v3 02/36] tests: fix test-qga leaks, marcandre . lureau, 2016/08/03
- [Qemu-devel] [PATCH for-2.7 v3 03/36] qga: free the whole blacklist, marcandre . lureau, 2016/08/03
- [Qemu-devel] [PATCH for-2.7 v3 04/36] qga: free remaining leaking state, marcandre . lureau, 2016/08/03
- Re: [Qemu-devel] [PATCH for-2.7 v3 04/36] qga: free remaining leaking state,
Markus Armbruster <=
- [Qemu-devel] [PATCH for-2.7 v3 05/36] tests: fix test-cutils leaks, marcandre . lureau, 2016/08/03
- [Qemu-devel] [PATCH for-2.7 v3 07/36] tests: fix test-iov leaks, marcandre . lureau, 2016/08/03
- [Qemu-devel] [PATCH for-2.7 v3 06/36] tests: fix test-vmstate leaks, marcandre . lureau, 2016/08/03
- [Qemu-devel] [PATCH for-2.7 v3 08/36] qdist: fix entries memory leak, marcandre . lureau, 2016/08/03
- [Qemu-devel] [PATCH for-2.7 v3 09/36] tests: fix check-qom-interface leaks, marcandre . lureau, 2016/08/03
- [Qemu-devel] [PATCH for-2.7 v3 10/36] tests: fix check-qom-proplist leaks, marcandre . lureau, 2016/08/03
- [Qemu-devel] [PATCH for-2.7 v3 11/36] tests: fix small leak in test-io-channel-command, marcandre . lureau, 2016/08/03
- [Qemu-devel] [PATCH for-2.7 v3 12/36] tests: fix leak in test-string-input-visitor, marcandre . lureau, 2016/08/03
- [Qemu-devel] [PATCH for-2.7 v3 13/36] portio: keep references on portio, marcandre . lureau, 2016/08/03
- [Qemu-devel] [PATCH for-2.7 v3 14/36] numa: do not leak NumaOptions, marcandre . lureau, 2016/08/03