Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Feb 2023 07:47:39 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 269509] Memory leak in ofwbus
Message-ID:  <bug-269509-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D269509

            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: bugs@FreeBSD.org
          Reporter: jarek@jpelczar.com

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

        for (node =3D OF_child(node); node > 0; node =3D OF_peer(node)) {
                if (ofw_bus_gen_setup_devinfo(&obd, node) !=3D 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 =3D OF_child(node); node > 0; node =3D OF_peer(node)) {
                if (ofw_bus_gen_setup_devinfo(&obd, node) !=3D 0)
                        continue;
                simplebus_add_device(dev, node, 0, NULL, -1, NULL);
+               ofw_bus_gen_destroy_devinfo(&obd);
        }

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-269509-227>