[glibc] nis: Fix a memory leak in nis_creategroup when malloc fails

Adhemerval Zanella via Glibc-cvs <[email protected]> Thu, 25 Jun 2026 19:57:59 +0000 (GMT)
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=96773cc77bc7596fb503dc1f0cf916a98f1c3701

commit 96773cc77bc7596fb503dc1f0cf916a98f1c3701
Author: Jiri Stransky <[email protected]>
Date:   Tue Jun 23 16:15:25 2026 +0200

    nis: Fix a memory leak in nis_creategroup when malloc fails
    
    The zo_domain field was missing from the list of fields to be freed.
    
    Reviewed-by: DJ Delorie <[email protected]>

Diff:
---
 nis/nis_creategroup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nis/nis_creategroup.c b/nis/nis_creategroup.c
index ea6fc61b08..167c07a123 100644
--- a/nis/nis_creategroup.c
+++ b/nis/nis_creategroup.c
@@ -60,6 +60,7 @@ nis_creategroup (const_nis_name group, unsigned int flags)
 	  free (obj->zo_group);
 	  free (obj->zo_owner);
 	  free (obj->zo_name);
+	  free (obj->zo_domain);
 	  free (obj);
 	  return NIS_NOMEMORY;
 	}