Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Free buffers only when allocated.



details:   https://anonhg.NetBSD.org/src/rev/7abc47c07705
branches:  trunk
changeset: 1006034:7abc47c07705
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Tue Dec 31 09:10:15 2019 +0000

description:
Free buffers only when allocated.

diffstat:

 sys/dev/acpi/acpi_util.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 8fa7c70237f1 -r 7abc47c07705 sys/dev/acpi/acpi_util.c
--- a/sys/dev/acpi/acpi_util.c  Tue Dec 31 08:01:19 2019 +0000
+++ b/sys/dev/acpi/acpi_util.c  Tue Dec 31 09:10:15 2019 +0000
@@ -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 @@
        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 @@
        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;
 }



Home | Main Index | Thread Index | Old Index