Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Dec 2019 18:50:16 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 242712] Networking device detach leaks memory
Message-ID:  <bug-242712-227@https.bugs.freebsd.org/bugzilla/>

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

            Bug ID: 242712
           Summary: Networking device detach leaks memory
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: ghuckriede@blackberry.com

Created attachment 210040
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D210040&action=
=3Dedit
before and after test results

A free() appears to have been removed by mistake.

line 1544 of https://svnweb.freebsd.org/base/head/sys/net/if.c?annotate=3D3=
34117
was removed by the following submission:=20=20=20=20=20=20=20=20
https://svnweb.freebsd.org/base/head/sys/net/if.c?revision=3D334118&view=3D=
markup

This introduced a memory leak when calling if_delgroups(), as the malloc is
still present in if_addgroup() on line 1458 of
https://svnweb.freebsd.org/base/head/sys/net/if.c?annotate=3D355070

Furthermore the free() is present for if_delgroup() on line 1551 of
https://svnweb.freebsd.org/base/head/sys/net/if.c?annotate=3D355070

Here is a fix along with a white space change.

svn diff sys/net/if.c
Index: sys/net/if.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/net/if.c        (revision 355854)
+++ sys/net/if.c        (working copy)
@@ -1594,9 +1594,10 @@
                free(ifgm, M_TEMP);
                if (ifglfree) {
                        EVENTHANDLER_INVOKE(group_detach_event,
-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20
ifgl->ifgl_group);
+                                           ifgl->ifgl_group);
                        free(ifgl->ifgl_group, M_TEMP);
                }
+               free(ifgl, M_TEMP);
                EVENTHANDLER_INVOKE(group_change_event, groupname);

                IFNET_WLOCK();

--=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-242712-227>