Free the header after possibly accessing it when tracing is enabled. Also guard

the trace output against header being NULL (i.e. failed to map).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39958 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2010-12-27 00:51:05 +00:00
parent cd7155635d
commit f3eff1ca00
+5 -2
View File
@@ -89,12 +89,15 @@ acpi_find_table(const char* signature)
if (header == NULL if (header == NULL
|| strncmp(header->signature, signature, 4) != 0) { || strncmp(header->signature, signature, 4) != 0) {
// not interesting for us // not interesting for us
TRACE(("acpi: Looking for '%.4s'. Skipping '%.4s'\n",
signature, header != NULL ? header->signature : "null"));
if (header != NULL) if (header != NULL)
mmu_free(header, sizeof(acpi_descriptor_header)); mmu_free(header, sizeof(acpi_descriptor_header));
TRACE(("acpi: Looking for '%.4s'. Skipping '%.4s'\n",
signature, header->signature));
continue; continue;
} }
TRACE(("acpi: Found '%.4s' @ %p\n", signature, pointer)); TRACE(("acpi: Found '%.4s' @ %p\n", signature, pointer));
return header; return header;
} }