提交 097a97a6 编写于 作者: K Kirill Batuzov 提交者: Michael S. Tsirkin

acpi-build: properly decrement objects' reference counters

Object returned by object_property_get_qobject needs its reference counter to
be decremented when it is not needed by caller anymore.
Signed-off-by: NKirill Batuzov <batuzovk@ispras.ru>
Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 7c38ecd0
...@@ -156,18 +156,21 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) ...@@ -156,18 +156,21 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)
} else { } else {
pm->s3_disabled = false; pm->s3_disabled = false;
} }
qobject_decref(o);
o = object_property_get_qobject(obj, ACPI_PM_PROP_S4_DISABLED, NULL); o = object_property_get_qobject(obj, ACPI_PM_PROP_S4_DISABLED, NULL);
if (o) { if (o) {
pm->s4_disabled = qint_get_int(qobject_to_qint(o)); pm->s4_disabled = qint_get_int(qobject_to_qint(o));
} else { } else {
pm->s4_disabled = false; pm->s4_disabled = false;
} }
qobject_decref(o);
o = object_property_get_qobject(obj, ACPI_PM_PROP_S4_VAL, NULL); o = object_property_get_qobject(obj, ACPI_PM_PROP_S4_VAL, NULL);
if (o) { if (o) {
pm->s4_val = qint_get_int(qobject_to_qint(o)); pm->s4_val = qint_get_int(qobject_to_qint(o));
} else { } else {
pm->s4_val = false; pm->s4_val = false;
} }
qobject_decref(o);
/* Fill in mandatory properties */ /* Fill in mandatory properties */
pm->sci_int = object_property_get_int(obj, ACPI_PM_PROP_SCI_INT, NULL); pm->sci_int = object_property_get_int(obj, ACPI_PM_PROP_SCI_INT, NULL);
...@@ -973,6 +976,7 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state) ...@@ -973,6 +976,7 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)
} }
} }
qobject_decref(bsel);
build_free_array(bus_table); build_free_array(bus_table);
build_pci_bus_state_cleanup(child); build_pci_bus_state_cleanup(child);
g_free(child); g_free(child);
...@@ -1362,10 +1366,12 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg) ...@@ -1362,10 +1366,12 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
return false; return false;
} }
mcfg->mcfg_base = qint_get_int(qobject_to_qint(o)); mcfg->mcfg_base = qint_get_int(qobject_to_qint(o));
qobject_decref(o);
o = object_property_get_qobject(pci_host, PCIE_HOST_MCFG_SIZE, NULL); o = object_property_get_qobject(pci_host, PCIE_HOST_MCFG_SIZE, NULL);
assert(o); assert(o);
mcfg->mcfg_size = qint_get_int(qobject_to_qint(o)); mcfg->mcfg_size = qint_get_int(qobject_to_qint(o));
qobject_decref(o);
return true; return true;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册