diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2014-03-27 23:50:54 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2014-03-27 23:50:54 +0000 |
commit | 7c6f304a2eb855cf2d71ca0638d4f3c72f436fcd (patch) | |
tree | d3e9e38245f10de28c87606c945c7fdd4bed0d76 /source/os_specific/service_layers/oswintbl.c | |
parent | 526d99544ba42a5a2155021975b3b97da425819e (diff) |
Notes
Diffstat (limited to 'source/os_specific/service_layers/oswintbl.c')
-rw-r--r-- | source/os_specific/service_layers/oswintbl.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/source/os_specific/service_layers/oswintbl.c b/source/os_specific/service_layers/oswintbl.c index daff7fe5d2c01..0afde6874f6a2 100644 --- a/source/os_specific/service_layers/oswintbl.c +++ b/source/os_specific/service_layers/oswintbl.c @@ -222,6 +222,7 @@ AcpiOsGetTableByName ( HKEY SubKey; ULONG i; ACPI_TABLE_HEADER *ReturnTable; + ACPI_STATUS Status = AE_OK; /* @@ -294,7 +295,8 @@ AcpiOsGetTableByName ( { fprintf (stderr, "Could not open %s entry: %s\n", Signature, WindowsFormatException (WinStatus)); - return (AE_ERROR); + Status = AE_ERROR; + goto Cleanup; } RegCloseKey (Handle); @@ -313,7 +315,8 @@ AcpiOsGetTableByName ( { fprintf (stderr, "Could not get %s registry entry: %s\n", Signature, WindowsFormatException (WinStatus)); - return (AE_ERROR); + Status = AE_ERROR; + goto Cleanup; } if (Type == REG_BINARY) @@ -326,11 +329,12 @@ AcpiOsGetTableByName ( WinStatus = RegQueryValueEx (Handle, KeyBuffer, NULL, NULL, NULL, &DataSize); - if (WinStatus != ERROR_SUCCESS) + if (WinStatus = ERROR_SUCCESS) { fprintf (stderr, "Could not read the %s table size: %s\n", Signature, WindowsFormatException (WinStatus)); - return (AE_ERROR); + Status = AE_ERROR; + goto Cleanup; } /* Allocate a new buffer for the table */ @@ -338,6 +342,7 @@ AcpiOsGetTableByName ( ReturnTable = malloc (DataSize); if (!ReturnTable) { + Status = AE_NO_MEMORY; goto Cleanup; } @@ -345,20 +350,21 @@ AcpiOsGetTableByName ( WinStatus = RegQueryValueEx (Handle, KeyBuffer, NULL, NULL, (UCHAR *) ReturnTable, &DataSize); - if (WinStatus != ERROR_SUCCESS) + if (WinStatus = ERROR_SUCCESS) { fprintf (stderr, "Could not read %s data: %s\n", Signature, WindowsFormatException (WinStatus)); free (ReturnTable); - return (AE_ERROR); + Status = AE_ERROR; + goto Cleanup; } -Cleanup: - RegCloseKey (Handle); - *Table = ReturnTable; *Address = 0; - return (AE_OK); + +Cleanup: + RegCloseKey (Handle); + return (Status); } |