diff options
author | Bruno Haible <bruno@clisp.org> | 2006-09-05 11:47:33 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2006-09-05 11:47:33 +0000 |
commit | 769ca58867a6b1e25a6b7558c17175fdfa579709 (patch) | |
tree | c80351022a2fa350c0f3421f7068ba6c6138c2ae | |
parent | d50444df2498a9c9b165ed0497ea66485024a3cb (diff) | |
download | gnulib-769ca58867a6b1e25a6b7558c17175fdfa579709.tar.gz |
(iconv_alloc): Don't assume that malloc() or realloc(), when failing, sets
errno to ENOMEM. (malloc on GNU/kFreeBSD doesn't.)
-rw-r--r-- | lib/iconvme.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/iconvme.c b/lib/iconvme.c index 0e3d7b5ccd..5de84cc529 100644 --- a/lib/iconvme.c +++ b/lib/iconvme.c @@ -131,7 +131,10 @@ iconv_alloc (iconv_t cd, const char *str) outp = dest = (char *) malloc (outbuf_size); if (dest == NULL) - return NULL; + { + errno = ENOMEM; + return NULL; + } again: err = iconv (cd, &p, &inbytes_remaining, &outp, &outbytes_remaining); @@ -159,6 +162,7 @@ again: newdest = (char *) realloc (dest, newsize); if (newdest == NULL) { + errno = ENOMEM; have_error = 1; goto out; } |