summaryrefslogtreecommitdiff
path: root/sys/dev/acpi/dsdt.c
diff options
context:
space:
mode:
authorJordan Hargrave <jordan@cvs.openbsd.org>2009-03-13 18:41:58 +0000
committerJordan Hargrave <jordan@cvs.openbsd.org>2009-03-13 18:41:58 +0000
commit5f2e066e8f14b83f7b881d72ffebb19d599289c1 (patch)
treeec91561aa58bc2eb0b6bc30df19a770aea3032e7 /sys/dev/acpi/dsdt.c
parent4f2193dd24fabfb8742e6cc95b63bbaf6efa244e (diff)
Fixed potential aml_freevalue on uninitialized stack , reported by krw
Fixup in acpidock for aml_evalinteger ok @marco
Diffstat (limited to 'sys/dev/acpi/dsdt.c')
-rw-r--r--sys/dev/acpi/dsdt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index 29edc0b01d3..12138792c08 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.141 2009/03/11 20:37:46 jordan Exp $ */
+/* $OpenBSD: dsdt.c,v 1.142 2009/03/13 18:41:57 jordan Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -4189,10 +4189,10 @@ aml_evalnode(struct acpi_softc *sc, struct aml_node *node,
static int wmstate;
#endif
- if (node == NULL || node->value == NULL)
- return (ACPI_E_BADVALUE);
if (res)
memset(res, 0, sizeof(*res));
+ if (node == NULL || node->value == NULL)
+ return (ACPI_E_BADVALUE);
dnprintf(12,"EVALNODE: %s %d\n", aml_nodename(node), acpi_nalloc);
switch (node->value->type) {
case AML_OBJTYPE_INTEGER:
@@ -4249,9 +4249,10 @@ aml_evalinteger(struct acpi_softc *sc, struct aml_node *parent,
parent = aml_searchname(parent, name);
rc = aml_evalnode(sc, parent, argc, argv, &res);
+ if (rc == 0) {
*ival = aml_val2int(&res);
aml_freevalue(&res);
-
+ }
return rc;
}