|Summary:||Potential memory leak in sbin/umount|
|Product:||Base System||Reporter:||Thomas Barabosch <thomas.barabosch>|
|Component:||bin||Assignee:||freebsd-bugs mailing list <bugs>|
|Severity:||Affects Many People||Keywords:||patch|
Description Thomas Barabosch 2018-06-14 19:56:17 UTC
Created attachment 194258 [details] 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.
Comment 1 Conrad Meyer 2018-06-15 01:43:25 UTC
addrinfo allocation is limited to at most one per NFS mountpoint to be unmounted, and memory is freed at program exit. I don't see a problem.