Module Name: src
Committed By: mlelstv
Date: Tue Dec 31 09:10:15 UTC 2019
Modified Files:
src/sys/dev/acpi: acpi_util.c
Log Message:
Free buffers only when allocated.
To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/acpi/acpi_util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/acpi/acpi_util.c
diff -u src/sys/dev/acpi/acpi_util.c:1.17 src/sys/dev/acpi/acpi_util.c:1.18
--- src/sys/dev/acpi/acpi_util.c:1.17 Sun Dec 29 13:45:11 2019
+++ src/sys/dev/acpi/acpi_util.c Tue Dec 31 09:10:15 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_util.c,v 1.17 2019/12/29 13:45:11 jmcneill Exp $ */
+/* $NetBSD: acpi_util.c,v 1.18 2019/12/31 09:10:15 mlelstv Exp $ */
/*-
* Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.17 2019/12/29 13:45:11 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.18 2019/12/31 09:10:15 mlelstv Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -694,7 +694,8 @@ acpi_dsd_integer(ACPI_HANDLE handle, con
if (ACPI_SUCCESS(rv))
*val = propval->Integer.Value;
- ACPI_FREE(buf.Pointer);
+ if (buf.Pointer != NULL)
+ ACPI_FREE(buf.Pointer);
return rv;
}
@@ -712,6 +713,7 @@ acpi_dsd_string(ACPI_HANDLE handle, cons
if (ACPI_SUCCESS(rv))
*val = kmem_strdup(propval->String.Pointer, KM_SLEEP);
- ACPI_FREE(buf.Pointer);
+ if (buf.Pointer != NULL)
+ ACPI_FREE(buf.Pointer);
return rv;
}