aboutsummaryrefslogtreecommitdiffstats
path: root/xmalloc.c
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2006-12-12 16:43:03 +0000
committerMatthias Andree <matthias.andree@gmx.de>2006-12-12 16:43:03 +0000
commit6419d6f7beb6af32facab158fcfb4f2dc973ccf0 (patch)
tree8129dac85b3fd1b92fb850428343bfbe116202f4 /xmalloc.c
parentde26c86dffa492ba2ffdff021e88d9891f8be9f3 (diff)
downloadfetchmail-6419d6f7beb6af32facab158fcfb4f2dc973ccf0.tar.gz
fetchmail-6419d6f7beb6af32facab158fcfb4f2dc973ccf0.tar.bz2
fetchmail-6419d6f7beb6af32facab158fcfb4f2dc973ccf0.zip
Fix crash on systems that do not provide strdup() in out-of-memory conditions.
Patch by Andreas Krennmair. svn path=/branches/BRANCH_6-3/; revision=4988
Diffstat (limited to 'xmalloc.c')
-rw-r--r--xmalloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xmalloc.c b/xmalloc.c
index c5af357c..a762d0a2 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -63,7 +63,8 @@ char *strdup(const char *s)
{
char *p;
p = (char *) malloc(strlen(s)+1);
- strcpy(p,s);
+ if (p)
+ strcpy(p,s);
return p;
}
#endif /* !HAVE_STRDUP */