From 8647f020c35bd91904cb67d65168c5b5f2521098 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 1 Sep 2018 15:57:03 +0200 Subject: m + strdup and strndup: use aligned_alloc(1, n) instead of malloc(n) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/string/strn/strndup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/string/strn') diff --git a/src/string/strn/strndup.c b/src/string/strn/strndup.c index 7d6e565..5dc17e0 100644 --- a/src/string/strn/strndup.c +++ b/src/string/strn/strndup.c @@ -39,7 +39,7 @@ char* strndup(const char* string, size_t maxlen) { size_t n = strnlen(string, maxlen) + 1; - char* r = malloc(n * sizeof(char)); + char* r = aligned_alloc(1, n * sizeof(char)); return r == NULL ? NULL : memcpy(r, string, n * sizeof(char)); } -- cgit v1.2.3-70-g09d2