https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269509

            Bug ID: 269509
           Summary: Memory leak in ofwbus
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: b...@freebsd.org
          Reporter: ja...@jpelczar.com

The ofwbus_attach function (in sys/dev/ofw/ofwbus.c) performs iteration over
nodes.

        for (node = OF_child(node); node > 0; node = OF_peer(node)) {
                if (ofw_bus_gen_setup_devinfo(&obd, node) != 0)
                        continue;
                simplebus_add_device(dev, node, 0, NULL, -1, NULL);
        }

ofw_bus_gen_setup_devinfo allocates memory to temporary buffer, however this
memory is never freed, so the change should probably look as follows:

        for (node = OF_child(node); node > 0; node = OF_peer(node)) {
                if (ofw_bus_gen_setup_devinfo(&obd, node) != 0)
                        continue;
                simplebus_add_device(dev, node, 0, NULL, -1, NULL);
+               ofw_bus_gen_destroy_devinfo(&obd);
        }

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to