Module Name:    src
Committed By:   thorpej
Date:           Wed Apr 24 06:03:02 UTC 2019

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

Log Message:
Fix leak of iba.iba_child_devices in fdtbus_attach_i2cbus().  Patch
provided by yarl-baudig %%at%% mailoo.org


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/fdt_i2c.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_i2c.c
diff -u src/sys/dev/fdt/fdt_i2c.c:1.6 src/sys/dev/fdt/fdt_i2c.c:1.7
--- src/sys/dev/fdt/fdt_i2c.c:1.6	Wed Jan 30 01:24:00 2019
+++ src/sys/dev/fdt/fdt_i2c.c	Wed Apr 24 06:03:02 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_i2c.c,v 1.6 2019/01/30 01:24:00 jmcneill Exp $ */
+/* $NetBSD: fdt_i2c.c,v 1.7 2019/04/24 06:03:02 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_i2c.c,v 1.6 2019/01/30 01:24:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_i2c.c,v 1.7 2019/04/24 06:03:02 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -106,6 +106,7 @@ fdtbus_attach_i2cbus(device_t dev, int p
 {
 	struct i2cbus_attach_args iba;
 	prop_dictionary_t devs, props;
+	device_t ret;
 	u_int address_cells;
 
 	devs = prop_dictionary_create();
@@ -124,5 +125,9 @@ fdtbus_attach_i2cbus(device_t dev, int p
 	props = device_properties(dev);
 	prop_dictionary_set_bool(props, "i2c-indirect-config", false);
 
-	return config_found_ia(dev, "i2cbus", &iba, print);
+	ret = config_found_ia(dev, "i2cbus", &iba, print);
+	if (iba.iba_child_devices)
+		prop_object_release(iba.iba_child_devices);
+
+	return ret;
 }

Reply via email to