about summary refs log tree commit diff
path: root/nis/nis_removemember.c
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nis_removemember.c')
-rw-r--r--nis/nis_removemember.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/nis/nis_removemember.c b/nis/nis_removemember.c
index 122c3022ff..21fe13aedf 100644
--- a/nis/nis_removemember.c
+++ b/nis/nis_removemember.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 1999, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1997,1998,1999,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -68,7 +68,10 @@ nis_removemember (const_nis_name member, const_nis_name group)
 	calloc (NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len,
 		sizeof (char *));
       if (newmem == NULL)
-	return NIS_NOMEMORY;
+	{
+	  nis_freeresult (res);
+	  return NIS_NOMEMORY;
+	}
 
       k = NIS_RES_OBJECT (res)[0].GR_data.gr_members.gr_members_len;
       j = 0;
@@ -96,6 +99,7 @@ nis_removemember (const_nis_name member, const_nis_name group)
       if (newp == NULL)
 	{
 	  free (newmem);
+	  nis_freeresult (res);
 	  return NIS_NOMEMORY;
 	}
       newmem = newp;