+2007-01-21 Bruno Haible <bruno@clisp.org>
+
+ * lib/striconv.c (str_iconv): Guarantee errno is set when strdup fails.
+ * lib/striconveh.c (str_iconveh): Likewise.
+
2007-01-21 Bruno Haible <bruno@clisp.org>
* lib/striconveh.h (mem_iconveh): New declaration.
str_iconv (const char *src, const char *from_codeset, const char *to_codeset)
{
if (c_strcasecmp (from_codeset, to_codeset) == 0)
- return strdup (src);
+ {
+ char *result = strdup (src);
+
+ if (result == NULL)
+ errno = ENOMEM;
+ return result;
+ }
else
{
#if HAVE_ICONV
enum iconv_ilseq_handler handler)
{
if (c_strcasecmp (from_codeset, to_codeset) == 0)
- return strdup (src);
+ {
+ char *result = strdup (src);
+
+ if (result == NULL)
+ errno = ENOMEM;
+ return result;
+ }
else
{
#if HAVE_ICONV