Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt Memory leak, found by mootja; not tested, but ob...



details:   https://anonhg.NetBSD.org/src/rev/ed5654488cc5
branches:  trunk
changeset: 818382:ed5654488cc5
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Oct 11 13:04:57 2016 +0000

description:
Memory leak, found by mootja; not tested, but obvious enough. By the way,
I guess we should be handling the return value of OF_getprop.

diffstat:

 sys/dev/fdt/fdt_pinctrl.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 1438e7b6adc4 -r ed5654488cc5 sys/dev/fdt/fdt_pinctrl.c
--- a/sys/dev/fdt/fdt_pinctrl.c Tue Oct 11 12:53:56 2016 +0000
+++ b/sys/dev/fdt/fdt_pinctrl.c Tue Oct 11 13:04:57 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_pinctrl.c,v 1.2 2016/01/01 22:35:44 marty Exp $ */
+/* $NetBSD: fdt_pinctrl.c,v 1.3 2016/10/11 13:04:57 maxv Exp $ */
 
 /*-
  * Copyright (c) 2015 Martin Fouts
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.2 2016/01/01 22:35:44 marty Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.3 2016/10/11 13:04:57 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -120,6 +120,7 @@
        next = result;
        while (next - result < len) {
                if (!strcmp(next, cfgname)) {
+                       kmem_free(result, len);
                        return fdtbus_pinctrl_set_config_index(phandle, index);
                }
                index++;
@@ -128,5 +129,6 @@
                next++;
        }
 
+       kmem_free(result, len);
        return -1;
 }



Home | Main Index | Thread Index | Old Index