X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=qga%2Fguest-agent-command-state.c;h=18bcb5941d51ddc99d389efccfdfd1c3f0cab4ff;hb=548fb0da730072d8c96b40ce29b024dd16cbab92;hp=969da23282b30cebc00b6a674f7e2cb39e2b5f07;hpb=7267c0947d7e8ae5dff7bafd932c3bc285f43e5c;p=mirror_qemu.git diff --git a/qga/guest-agent-command-state.c b/qga/guest-agent-command-state.c index 969da23282..18bcb5941d 100644 --- a/qga/guest-agent-command-state.c +++ b/qga/guest-agent-command-state.c @@ -9,8 +9,8 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ -#include -#include "qga/guest-agent-core.h" +#include "qemu/osdep.h" +#include "guest-agent-core.h" struct GACommandState { GSList *groups; @@ -27,7 +27,7 @@ void ga_command_state_add(GACommandState *cs, void (*init)(void), void (*cleanup)(void)) { - GACommandGroup *cg = g_malloc0(sizeof(GACommandGroup)); + GACommandGroup *cg = g_new0(GACommandGroup, 1); cg->init = init; cg->cleanup = cleanup; cs->groups = g_slist_append(cs->groups, cg); @@ -67,7 +67,13 @@ void ga_command_state_cleanup_all(GACommandState *cs) GACommandState *ga_command_state_new(void) { - GACommandState *cs = g_malloc0(sizeof(GACommandState)); + GACommandState *cs = g_new0(GACommandState, 1); cs->groups = NULL; return cs; } + +void ga_command_state_free(GACommandState *cs) +{ + g_slist_free_full(cs->groups, g_free); + g_free(cs); +}