Bug 179832

Summary: manual page of mac_from_text suggests incorrect freeing of mac_t type
Product: Documentation Reporter: Priit Järv <priit>
Component: Manual PagesAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me CC: doc, felix.the.red
Priority: Normal Keywords: easy
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
mac_free.3 patch and mac_text.3 patch felix.the.red: maintainer-approval? (felix.the.red)

Description Priit Järv 2013-06-22 09:20:00 UTC
manual page of mac_from_text(3) notes that the allocated storage should be freed with free(). I strongly suspect this is incorrect, as the type mac_t points to a structure which itself contains a pointer.

It seems this was introduced in svn rev 122777 where "mac_free(3)" was changed to "free(3)". It seems the specific change was meant for the mac_to_text() function call (a char* pointer indeed should be freed with free()).

Reported for 9.1-RELEASE but still present in head/stable.

Fix: 

Replace the text "which must later be freed with free(3)" with "which must later be freed with mac_free(3)". Additionally, it may be useful to mention in the next section that the text pointer allocated by mac_to_text() should be freed with free() - that seems to have been the intent of commit r122777.
How-To-Repeat: man mac_text
Comment 1 Tom Rhodes freebsd_committer freebsd_triage 2014-01-08 20:10:21 UTC
Responsible Changed
From-To: freebsd-doc->rwatson

Over to Robert.
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:16 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 3 Felix Johnson freebsd_triage 2021-09-30 07:20:13 UTC
Created attachment 228276 [details]
mac_free.3 patch and mac_text.3 patch

For mac_text(3), change reference to free(3) back to mac_free(3) for mac_from_text.

For mac_free(3), change a variable type from mac_3 to mac_t.