summaryrefslogtreecommitdiff
path: root/nss/nss_files/files-netgrp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-05-07 03:57:57 +0000
committerUlrich Drepper <drepper@redhat.com>2004-05-07 03:57:57 +0000
commit9be31a514921c7415d61834ffa1387f24f631dfb (patch)
treee6d77813cd31858a49c7315b98510e3e3fc06c13 /nss/nss_files/files-netgrp.c
parentf1debaf68214cb898f67355ee83169cc135e14e9 (diff)
downloadglibc-9be31a514921c7415d61834ffa1387f24f631dfb.tar.gz
Update.
* sysdeps/unix/sysv/linux/ifreq.c (__ifreq): Fix memory handling. * sysdeps/generic/ifreq.c (__ifreq): Fix memory handling. * resolv/res_hconf.c (_res_hconf_reorder_addrs): Make clear that realloc cannot fail. * nss/nss_files/files-netgrp.c (EXPAND): Free buffer which cannot be expanded. * nis/nis_table.c: Clean up memory handling. * nis/nis_subr.c (nis_getnames): Clean up memory handling. * nis/nis_removemember.c (nis_removemember): Add comment explaining use of realloc.
Diffstat (limited to 'nss/nss_files/files-netgrp.c')
-rw-r--r--nss/nss_files/files-netgrp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/nss/nss_files/files-netgrp.c b/nss/nss_files/files-netgrp.c
index 34d2b64473..e207691996 100644
--- a/nss/nss_files/files-netgrp.c
+++ b/nss/nss_files/files-netgrp.c
@@ -1,5 +1,5 @@
/* Netgroup file parser in nss_files modules.
- Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2000, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -34,12 +34,14 @@
do \
{ \
size_t old_cursor = result->cursor - result->data; \
+ void *old_data = result->data; \
\
result->data_size += 512 > 2 * needed ? 512 : 2 * needed; \
result->data = realloc (result->data, result->data_size); \
\
if (result->data == NULL) \
{ \
+ free (old_data); \
status = NSS_STATUS_UNAVAIL; \
goto the_end; \
} \