summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-12-11 18:56:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:25 -0500
commit18f9156d96cba17adc199d0e8c4cf1d6c9ae1960 (patch)
tree098045911d895a7e21b1bf8aaa6799447eb75747 /source3/lib
parent25d6eaae8d0d885add7e64b96df7a489328c6b0f (diff)
downloadsamba-18f9156d96cba17adc199d0e8c4cf1d6c9ae1960.tar.gz
samba-18f9156d96cba17adc199d0e8c4cf1d6c9ae1960.tar.bz2
samba-18f9156d96cba17adc199d0e8c4cf1d6c9ae1960.zip
r20110: Fix interaction between paranoid malloc checker
and lib/replace. Found by Herb - thanks ! Jeremy. (This used to be commit 67c4d5e73fe066910f7b1ca4624541a9bbbf7750)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index d1801527e9..9ac0b37612 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2434,8 +2434,16 @@ char *smb_xstrdup(const char *s)
#undef strdup
#endif
#endif
+
+#ifndef HAVE_STRDUP
+#define strdup rep_strdup
+#endif
+
char *s1 = strdup(s);
#if defined(PARANOID_MALLOC_CHECKER)
+#ifdef strdup
+#undef strdup
+#endif
#define strdup(s) __ERROR_DONT_USE_STRDUP_DIRECTLY
#endif
if (!s1)
@@ -2455,8 +2463,17 @@ char *smb_xstrndup(const char *s, size_t n)
#undef strndup
#endif
#endif
+
+#if (defined(BROKEN_STRNDUP) || !defined(HAVE_STRNDUP))
+#undef HAVE_STRNDUP
+#define strndup rep_strndup
+#endif
+
char *s1 = strndup(s, n);
#if defined(PARANOID_MALLOC_CHECKER)
+#ifdef strndup
+#undef strndup
+#endif
#define strndup(s,n) __ERROR_DONT_USE_STRNDUP_DIRECTLY
#endif
if (!s1)