summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/utcopy.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/utcopy.c')
-rw-r--r--sys/contrib/dev/acpica/utcopy.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/sys/contrib/dev/acpica/utcopy.c b/sys/contrib/dev/acpica/utcopy.c
index 2153f17..d385678 100644
--- a/sys/contrib/dev/acpica/utcopy.c
+++ b/sys/contrib/dev/acpica/utcopy.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
- * $Revision: 112 $
+ * $Revision: 113 $
*
*****************************************************************************/
@@ -741,14 +741,23 @@ AcpiUtCopySimpleObject (
if ((SourceDesc->Buffer.Pointer) &&
(!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
{
- DestDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->Buffer.Length);
- if (!DestDesc->Buffer.Pointer)
+ DestDesc->Buffer.Pointer = NULL;
+
+ /* Create an actual buffer only if length > 0 */
+
+ if (SourceDesc->Buffer.Length)
{
- return (AE_NO_MEMORY);
- }
+ DestDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->Buffer.Length);
+ if (!DestDesc->Buffer.Pointer)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Copy the actual buffer data */
- ACPI_MEMCPY (DestDesc->Buffer.Pointer, SourceDesc->Buffer.Pointer,
- SourceDesc->Buffer.Length);
+ ACPI_MEMCPY (DestDesc->Buffer.Pointer, SourceDesc->Buffer.Pointer,
+ SourceDesc->Buffer.Length);
+ }
}
break;
OpenPOWER on IntegriCloud