about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-09-01 07:29:10 +0000
committerUlrich Drepper <drepper@redhat.com>2000-09-01 07:29:10 +0000
commit67aacae67463402914388cec16190cd558c91792 (patch)
tree37c05d4b6b35ed321bd037258287d7bcb0a9a1b2
parent7e48149628690331133359c8a4160482e20bba2b (diff)
downloadglibc-67aacae67463402914388cec16190cd558c91792.tar.gz
glibc-67aacae67463402914388cec16190cd558c91792.tar.xz
glibc-67aacae67463402914388cec16190cd558c91792.zip
(__gconv_open): Set res to __GCONV_NOMEM is malloc fails.
-rw-r--r--iconv/gconv_open.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/iconv/gconv_open.c b/iconv/gconv_open.c
index 842bf73566..a84ed2fb9e 100644
--- a/iconv/gconv_open.c
+++ b/iconv/gconv_open.c
@@ -223,7 +223,10 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
 			  newp = (struct __gconv_trans_data *)
 			    malloc (sizeof (struct __gconv_trans_data));
 			  if (newp == NULL)
-			    goto bail;
+			    {
+			      res = __GCONV_NOMEM;
+			      goto bail;
+			    }
 
 			  newp->__trans_fct = runp->trans_fct;
 			  newp->__trans_context_fct = runp->trans_context_fct;
@@ -251,7 +254,10 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
 
 		  result->__data[cnt].__outbuf = (char *) malloc (size);
 		  if (result->__data[cnt].__outbuf == NULL)
-		    goto bail;
+		    {
+		      res = __GCONV_NOMEM;
+		      goto bail;
+		    }
 
 		  result->__data[cnt].__outbufend =
 		    result->__data[cnt].__outbuf + size;