From 6419d6f7beb6af32facab158fcfb4f2dc973ccf0 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Tue, 12 Dec 2006 16:43:03 +0000 Subject: 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 --- xmalloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'xmalloc.c') 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 */ -- cgit v1.2.3