On Mon, Feb 15, 2021 at 10:11:19 +0100, Michal Privoznik wrote: > On 2/12/21 6:55 PM, Peter Krempa wrote: > > The parent array takes ownership of the inserted value once all checks > > pass. Don't make the callers second-guess when that happens and modify > > the function to take a double pointer so that it can be cleared once the > > ownership is taken. > > > > Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> > > --- > > src/locking/lock_daemon.c | 3 +-- > > src/logging/log_handler.c | 3 +-- > > src/network/leaseshelper.c | 3 +-- > > src/node_device/node_device_driver.c | 2 +- > > src/qemu/qemu_agent.c | 7 ++----- > > src/qemu/qemu_block.c | 16 ++++------------ > > src/qemu/qemu_command.c | 3 +-- > > src/qemu/qemu_firmware.c | 4 +--- > > src/qemu/qemu_migration_params.c | 4 +--- > > src/qemu/qemu_monitor_json.c | 11 +++-------- > > src/rpc/virnetserver.c | 6 ++---- > > src/rpc/virnetserverservice.c | 3 +-- > > src/util/virjson.c | 12 +++++------- > > src/util/virjson.h | 3 ++- > > src/util/virlease.c | 2 +- > > src/util/virlockspace.c | 6 ++---- > > src/util/virmacmap.c | 6 ++---- > > tests/testutilsqemuschema.c | 3 +-- > > 18 files changed, 32 insertions(+), 65 deletions(-) > > I think the following should be squashed in: > > diff --git i/src/qemu/qemu_monitor_json.c w/src/qemu/qemu_monitor_json.c > index 924e03b4da..2e040a2bc1 100644 > --- i/src/qemu/qemu_monitor_json.c > +++ w/src/qemu/qemu_monitor_json.c > @@ -7580,7 +7580,6 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID, > > cleanup: > VIR_FREE(tlsalias); > - virJSONValueFree(addr); > virJSONValueFree(data); > virJSONValueFree(backend); > return ret; The value is stolen on success only, so we must free it explictly, or it can be separately converted to converted to g_autoptr.