about summary refs log tree commit diff
path: root/libidn/stringprep.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 /libidn/stringprep.c
parentf1debaf68214cb898f67355ee83169cc135e14e9 (diff)
downloadglibc-9be31a514921c7415d61834ffa1387f24f631dfb.tar.gz
glibc-9be31a514921c7415d61834ffa1387f24f631dfb.tar.xz
glibc-9be31a514921c7415d61834ffa1387f24f631dfb.zip
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 'libidn/stringprep.c')
-rw-r--r--libidn/stringprep.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libidn/stringprep.c b/libidn/stringprep.c
index 1841b36178..6041e3937a 100644
--- a/libidn/stringprep.c
+++ b/libidn/stringprep.c
@@ -370,9 +370,13 @@ stringprep (char *in,
 	free (ucs4);
       ucs4 = stringprep_utf8_to_ucs4 (in, -1, &ucs4len);
       maxucs4len = ucs4len + adducs4len;
-      ucs4 = realloc (ucs4, maxucs4len * sizeof (uint32_t));
-      if (!ucs4)
-	return STRINGPREP_MALLOC_ERROR;
+      uint32_t *newp = realloc (ucs4, maxucs4len * sizeof (uint32_t));
+      if (!newp)
+	{
+	  free (ucs4);
+	  return STRINGPREP_MALLOC_ERROR;
+	}
+      ucs4 = newp;
 
       rc = stringprep_4i (ucs4, &ucs4len, maxucs4len, flags, profile);
       adducs4len += 50;