[PATCH v9 01/15] Do not duplicate NULL in xstrdup
Nikolay Marchuk
marchuk.nikolay.a at gmail.com
Thu Aug 24 11:19:39 UTC 2017
---
xmalloc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/xmalloc.c b/xmalloc.c
index 45ff57b1..b77f6910 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -91,6 +91,9 @@ xreallocarray(void *ptr, size_t nmemb, size_t size)
char *
xstrdup(const char *str)
{
+ if (!str)
+ return NULL;
+
char *p = strdup(str);
if (!p)
--
2.11.0
More information about the Strace-devel
mailing list