acpi: fix uninitialized members of element object

The default constructor didn't initialize all members, some of them holding
pointers. In the de-constructor the _name pointer was tried to free up, even
when it was not initialized.

Avoid any hassle for uninitialized members and just initialize it. Fixes
sporadic page fault on x86_64 base-nova.

Issue #155
This commit is contained in:
Alexander Boettcher 2013-01-22 15:15:49 +01:00 committed by Norman Feske
parent 1947d08e78
commit 44e7aa7d61
1 changed files with 4 additions and 6 deletions

View File

@ -600,11 +600,14 @@ class Element : public List<Element>::Element
}
}
Element(uint8_t const *data, bool package_op4 = false)
Element(uint8_t const *data = 0, bool package_op4 = false)
:
_type(0), _size(0), _size_len(0), _name(0), _name_len(0), _bdf(0), _data(data),
_valid(false), _routed(false), _pci(0)
{
if (!data)
return;
/* special handle for four value packet */
if (package_op4) {
/* scan for data package with four entries */
@ -663,11 +666,6 @@ class Element : public List<Element>::Element
}
}
/**
* Default constructor
*/
Element() : _valid(false) {}
/**
* Copy constructor
*/