The reason why @entry variable in qemuMonitorJSONExtractPRManagerInfo()
was declared at the top most level was that the variable is used under
the cleanup label. However, if declared using g_autofree then the
variable can be declared inside the loop it is used in.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
qemuMonitorJSONExtractPRManagerInfo(virJSONValue *reply,
GHashTable *info)
{
- qemuMonitorPRManagerInfo *entry = NULL;
virJSONValue *data;
int ret = -1;
size_t i;
data = virJSONValueObjectGetArray(reply, "return");
for (i = 0; i < virJSONValueArraySize(data); i++) {
+ g_autofree qemuMonitorPRManagerInfo *entry = NULL;
virJSONValue *prManager = virJSONValueArrayGet(data, i);
const char *alias;
ret = 0;
cleanup:
- VIR_FREE(entry);
return ret;
malformed: