# HG changeset patch # User Bruno Haible # Date 1157456853 0 # Node ID 86ec317a7b82a04e8573d3a54d014e910a3d823a # Parent db39032b00438628f26bacb1cb128a05df4629fe (iconv_alloc): Don't assume that malloc() or realloc(), when failing, sets errno to ENOMEM. (malloc on GNU/kFreeBSD doesn't.) diff --git a/lib/iconvme.c b/lib/iconvme.c --- a/lib/iconvme.c +++ b/lib/iconvme.c @@ -131,7 +131,10 @@ 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 @@ newdest = (char *) realloc (dest, newsize); if (newdest == NULL) { + errno = ENOMEM; have_error = 1; goto out; }