[Bug 229020] Potential memory leak in sbin/umount

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Jun 14 19:56:19 UTC 2018


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

            Bug ID: 229020
           Summary: Potential memory leak in sbin/umount
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: thomas.barabosch at fkie.fraunhofer.de

Created attachment 194258
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=194258&action=edit
Possible patch

There may be a potential memory leak in sbin/umount. In function umountfs there
is a call to getaddrinfo. According to getaddrinfo.3:

"All of the     information returned by getaddrinfo() is dynamically allo-
     cated: the addrinfo structures themselves as well as the socket address
     structures and the canonical host name strings included in the addrinfo
     structures.

     Memory allocated for the dynamically allocated structures created by a
     successful call to getaddrinfo() is released by the freeaddrinfo() func-
     tion.  The ai pointer should be a addrinfo structure created by a call to
     getaddrinfo()."

However, the whole file umount.c does not make a single call to freeaddrinfo().
It would be better to free the addrinfo with freeaddrinfo to prevent a
potential memory leak.

Can you confirm this problem?

I've attached a patch as a possible solution.

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


More information about the freebsd-bugs mailing list