Bug 179832 - manual page of mac_from_text suggests incorrect freeing of mac_t type
Summary: manual page of mac_from_text suggests incorrect freeing of mac_t type
Status: Open
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: easy
Depends on:
Blocks:
 
Reported: 2013-06-22 09:20 UTC by Priit Järv
Modified: 2022-12-31 10:18 UTC (History)
2 users (show)

See Also:


Attachments
mac_free.3 patch and mac_text.3 patch (781 bytes, patch)
2021-09-30 07:20 UTC, Felix Johnson
felix.the.red: maintainer-approval? (felix.the.red)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.