about summary refs log tree commit diff
path: root/nis/nis_checkpoint.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-05-14 23:38:21 +0000
committerUlrich Drepper <drepper@redhat.com>1999-05-14 23:38:21 +0000
commit843ede44f78a91de84613f7581efadb13dbc6d25 (patch)
treea0b7d96433062ff25d96994ba9aec288d4629f91 /nis/nis_checkpoint.c
parent1483b7537883c00276b91f8c35496594edd5b073 (diff)
downloadglibc-843ede44f78a91de84613f7581efadb13dbc6d25.tar.gz
glibc-843ede44f78a91de84613f7581efadb13dbc6d25.tar.xz
glibc-843ede44f78a91de84613f7581efadb13dbc6d25.zip
Update.
1999-05-14  Ulrich Drepper  <drepper@cygnus.com>

	* nis/nis_getservlist.c (nis_getservlist): Use malloc instead of
	calloc.

	* nis/nis_checkpoint.c (nis_checkpoint): Fix memory leaks.
	* nis/nis_addmember.c (nis_addmember): Fix memory leak.  Test
	memory allocation results.
Diffstat (limited to 'nis/nis_checkpoint.c')
-rw-r--r--nis/nis_checkpoint.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/nis/nis_checkpoint.c b/nis/nis_checkpoint.c
index 15bae8be22..3d5847295b 100644
--- a/nis/nis_checkpoint.c
+++ b/nis/nis_checkpoint.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -39,11 +39,15 @@ nis_checkpoint(const_nis_name dirname)
 
       res2 = nis_lookup (dirname, EXPAND_NAME);
       if (NIS_RES_STATUS (res2) != NIS_SUCCESS)
-        return res2;
+	{
+	  free (res);
+	  return res2;
+	}
 
       /* Check if obj is really a diryectory object */
       if (__type_of (NIS_RES_OBJECT (res2)) != NIS_DIRECTORY_OBJ)
 	{
+	  nis_freeresult (res2);
 	  nis_freeresult (res);
 	  NIS_RES_STATUS (res) = NIS_INVALIDOBJ;
 	  return res;