From 39b12015846e06cbf89079e365e6c228ca3883c2 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 13 Jul 2004 03:23:55 +0000 Subject: r1474: It is useful if talloc_strdup() behaves like strdup() - NULL in, NULL out Andrew Bartlett (This used to be commit 2cc0b3a2f1785c53268f018999a87c26539fd4a6) --- source4/lib/talloc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/talloc.c b/source4/lib/talloc.c index 9f873a2d6b..421a09e3c6 100644 --- a/source4/lib/talloc.c +++ b/source4/lib/talloc.c @@ -381,6 +381,9 @@ void *talloc_memdup(TALLOC_CTX *t, const void *p, size_t size) /** strdup with a talloc */ char *talloc_strdup(TALLOC_CTX *t, const char *p) { + if (!p) { + return NULL; + } return talloc_memdup(t, p, strlen(p) + 1); } -- cgit