From 18f9156d96cba17adc199d0e8c4cf1d6c9ae1960 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 11 Dec 2006 18:56:36 +0000 Subject: r20110: Fix interaction between paranoid malloc checker and lib/replace. Found by Herb - thanks ! Jeremy. (This used to be commit 67c4d5e73fe066910f7b1ca4624541a9bbbf7750) --- source3/lib/util.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source3/lib/util.c') 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) -- cgit