Bug 249296 - net/openmdns: fix memory leaks
Summary: net/openmdns: fix memory leaks
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Alexey Dokuchaev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-13 20:56 UTC by Nick Briggs
Modified: 2021-07-14 17:40 UTC (History)
1 user (show)

See Also:


Attachments
Patch to fix memory leaks (927 bytes, patch)
2020-09-13 20:56 UTC, Nick Briggs
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Briggs 2020-09-13 20:56:07 UTC
Created attachment 217937 [details]
Patch to fix memory leaks

The openmdns daemon leaks memory in various expected paths.
The patch against the version of the code currently distributed in ports is attached.  

I'd note, however, that the port appears to have been abandoned by its original author -- I have submitted a pull request for one other logging issue, and this patch as a comment on a bug report in his github repo and have received no response.
Comment 1 Dmitry Marakasov freebsd_committer freebsd_triage 2021-02-16 00:26:28 UTC
Wrong take
Comment 2 commit-hook freebsd_committer freebsd_triage 2021-07-13 10:21:15 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b275a10c2b0eb472235faf136a58f1a580578509

commit b275a10c2b0eb472235faf136a58f1a580578509
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2021-07-13 10:19:12 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2021-07-13 10:19:34 +0000

    net/openmdns: fix daemon memory leaks in various expected paths.

    PR:     249296

 net/openmdns/Makefile                 |  2 +-
 net/openmdns/files/patch-mdnsd_mdns.c | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)
Comment 3 Nick Briggs 2021-07-13 15:20:42 UTC
I should note that the original author of this code did finally make the leak fix (plus one I missed) at https://github.com/haesbaert/mdnsd/commit/e8dc3ce0d2d42d4487a1d7ed48249a5338ea5cff -- but the code doesn't appear to have been released (at least not in the github sense) since the 0.7 release of 10-Mar-2017 -- don't know about the OpenBSD status.
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-07-13 17:16:26 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=523c21a6ec6468b29cf704f7bc3bfb26aaf3e0e0

commit 523c21a6ec6468b29cf704f7bc3bfb26aaf3e0e0
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2021-07-13 17:12:08 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2021-07-13 17:12:20 +0000

    net/openmdns: amend the previous fix (add two more missing free() calls).

    PR:     249296

 net/openmdns/files/patch-mdnsd_mdns.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
Comment 5 Nick Briggs 2021-07-13 17:18:35 UTC
(In reply to commit-hook from comment #4)

Thanks Alexy!
Comment 6 Alexey Dokuchaev freebsd_committer freebsd_triage 2021-07-14 09:13:22 UTC
(In reply to Nick Briggs from comment #5)

No problem.  If you'd updated the PR with a link to that Mayish commit earlier, we could avoid doing second commit. :-)

Just want to confirm something: you said "plus one I missed", but comparing the patches, there were two missing hunks.  Is your counting off or mine?
Comment 7 Nick Briggs 2021-07-14 17:40:32 UTC
(In reply to Alexey Dokuchaev from comment #6)
TBH, I'd forgotten that I'd reported the problem here.  I had hoped that Haesbert would tag and release a new version of the code to the OpenBSD folks, which would then flow through to here.

Haesbert found 1 additional place that I had missed in my pull-request.  My pull-request to him had one additional fix beyond what I had proposed patching in this problem report -- so both 1 and 2 are correct counts depending on what base you're starting from.    I think you've got everything now.   Thanks.