When returning early due to errors, cmd will be leaked. Use an autoptr
to handle these early returns without leaking memory.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
char **errbuf)
{
g_autofree char *parent_addr = NULL;
- virCommand *cmd = NULL;
+ g_autoptr(virCommand) cmd = NULL;
const char *subcommand = virMdevctlCommandTypeToString(cmd_type);
g_autofree char *inbuf = NULL;
virCommandSetErrorBuffer(cmd, errbuf);
- return cmd;
+ return g_steal_pointer(&cmd);
}