summaryrefslogtreecommitdiff
path: root/lib/striconv.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-01-21 22:18:23 +0000
committerBruno Haible <bruno@clisp.org>2007-01-21 22:18:23 +0000
commitec32a9f497d23fc1d7c7e0847ec008ca5a8bb299 (patch)
tree7215295a424bbc78d0c45b0717c7cdb4837a0f42 /lib/striconv.c
parent765f0950e35710f3c4299062fc60319f018d1779 (diff)
downloadgnulib-ec32a9f497d23fc1d7c7e0847ec008ca5a8bb299.tar.gz
Ensure errno when strdup fails.
Diffstat (limited to 'lib/striconv.c')
-rw-r--r--lib/striconv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/striconv.c b/lib/striconv.c
index b2490a750d..7c4f549cf6 100644
--- a/lib/striconv.c
+++ b/lib/striconv.c
@@ -398,7 +398,13 @@ char *
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