about summary refs log tree commit diff
path: root/nis/nss_nis/nis-netgrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_nis/nis-netgrp.c')
-rw-r--r--nis/nss_nis/nis-netgrp.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/nis/nss_nis/nis-netgrp.c b/nis/nss_nis/nis-netgrp.c
index c9b52428c3..e9318d6e95 100644
--- a/nis/nss_nis/nis-netgrp.c
+++ b/nis/nss_nis/nis-netgrp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,1999,2000,2002,2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
 
@@ -42,6 +42,19 @@ extern enum nss_status
 _nss_netgroup_parseline (char **cursor, struct __netgrent *result,
 			 char *buffer, size_t buflen, int *errnop);
 
+
+static void
+internal_nis_endnetgrent (void)
+{
+  if (data != NULL)
+    {
+      free (data);
+      data = NULL;
+      data_size = 0;
+      cursor = NULL;
+    }
+}
+
 enum nss_status
 _nss_nis_setnetgrent (const char *group, struct __netgrent *dummy)
 {
@@ -60,13 +73,7 @@ _nss_nis_setnetgrent (const char *group, struct __netgrent *dummy)
 
   __libc_lock_lock (lock);
 
-  if (data != NULL)
-    {
-      free (data);
-      data = NULL;
-      data_size = 0;
-      cursor = NULL;
-    }
+  internal_nis_endnetgrent ();
 
   group_len = strlen (group);
 
@@ -96,13 +103,7 @@ _nss_nis_endnetgrent (struct __netgrent *dummy)
 {
   __libc_lock_lock (lock);
 
-  if (data != NULL)
-    {
-      free (data);
-      data = NULL;
-      data_size = 0;
-      cursor = NULL;
-    }
+  internal_nis_endnetgrent ();
 
   __libc_lock_unlock (lock);