Module Name:    src
Committed By:   maxv
Date:           Tue Oct 11 13:04:57 UTC 2016

Modified Files:
        src/sys/dev/fdt: fdt_pinctrl.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/fdt_pinctrl.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/fdt/fdt_pinctrl.c
diff -u src/sys/dev/fdt/fdt_pinctrl.c:1.2 src/sys/dev/fdt/fdt_pinctrl.c:1.3
--- src/sys/dev/fdt/fdt_pinctrl.c:1.2	Fri Jan  1 22:35:44 2016
+++ src/sys/dev/fdt/fdt_pinctrl.c	Tue Oct 11 13:04:57 2016
@@ -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 @@ fdtbus_pinctrl_set_config(int phandle, c
 	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 @@ fdtbus_pinctrl_set_config(int phandle, c
 		next++;
 	}
 
+	kmem_free(result, len);
 	return -1;
 }

Reply via email to