Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt Fix leak of iba.iba_child_devices in fdtbus_atta...



details:   https://anonhg.NetBSD.org/src/rev/035984096a46
branches:  trunk
changeset: 450720:035984096a46
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Apr 24 06:03:02 2019 +0000

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

diffstat:

 sys/dev/fdt/fdt_i2c.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r 9de6ab74d9a5 -r 035984096a46 sys/dev/fdt/fdt_i2c.c
--- a/sys/dev/fdt/fdt_i2c.c     Wed Apr 24 05:31:24 2019 +0000
+++ b/sys/dev/fdt/fdt_i2c.c     Wed Apr 24 06:03:02 2019 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
 {
        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 @@
        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;
 }



Home | Main Index | Thread Index | Old Index