git: 98693e7a99c4 - stable/13 - libc: correct some memory leaks in acl_to_text(3) and acl_to_text_np(3)

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 21 Dec 2023 15:21:13 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=98693e7a99c489e7f095c3600c974b0f61a060f1

commit 98693e7a99c489e7f095c3600c974b0f61a060f1
Author:     Peter Eriksson <pen@lysator.liu.se>
AuthorDate: 2023-12-17 22:03:13 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-12-21 15:20:39 +0000

    libc: correct some memory leaks in acl_to_text(3) and acl_to_text_np(3)
    
    PR:     275232
    
    (cherry picked from commit 7aa375dcc61e48cc56da45c9d5a11371693c8043)
---
 lib/libc/posix1e/acl_to_text_nfs4.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/libc/posix1e/acl_to_text_nfs4.c b/lib/libc/posix1e/acl_to_text_nfs4.c
index 522ebe3d4373..8a4783736aa6 100644
--- a/lib/libc/posix1e/acl_to_text_nfs4.c
+++ b/lib/libc/posix1e/acl_to_text_nfs4.c
@@ -73,6 +73,7 @@ format_who(char *str, size_t size, const acl_entry_t entry, int numeric)
 			snprintf(str, size, "user:%d", (unsigned int)*id);
 		else
 			snprintf(str, size, "user:%s", pwd->pw_name);
+		acl_free(id);
 		break;
 
 	case ACL_GROUP_OBJ:
@@ -92,6 +93,7 @@ format_who(char *str, size_t size, const acl_entry_t entry, int numeric)
 			snprintf(str, size, "group:%d", (unsigned int)*id);
 		else
 			snprintf(str, size, "group:%s", grp->gr_name);
+		acl_free(id);
 		break;
 
 	case ACL_EVERYONE:
@@ -158,6 +160,7 @@ format_additional_id(char *str, size_t size, const acl_entry_t entry)
 		if (id == NULL)
 			return (-1);
 		snprintf(str, size, ":%d", (unsigned int)*id);
+		acl_free(id);
 	}
 
 	return (0);