On 12/20/19 4:16 PM, Daniel Henrique Barboza wrote:
Change all feasible pointers to use g_autoptr().
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_process.c | 123 ++++++++++++++--------------------------
1 file changed, 41 insertions(+), 82 deletions(-)
@@ -4340,7 +4314,7 @@ qemuProcessFetchCPUDefinitions(virQEMUDriverPtr driver,
virDomainCapsCPUModelsPtr *cpuModels)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- virDomainCapsCPUModelsPtr models = NULL;
+ g_autoptr(virDomainCapsCPUModels) models = NULL;
int rc;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
@@ -4355,7 +4329,6 @@ qemuProcessFetchCPUDefinitions(virQEMUDriverPtr driver,
return 0;
error:
- virObjectUnref(models);
return -1;
}
The 'error:' label here tipped me that something might be off. 'models'
is only supposed to be freed on error, but this frees it
unconditionally. I adapted this function to use g_steal_pointer as well,
and pushed this series with that addition
Thanks,
Cole