From 7540f65fd4e4906ee052425c0504ae6f07e535d6 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 20 May 2014 18:14:48 -0700 Subject: [PATCH] xalloc: don't potentially generate invalid code for xmemdup calls * lib/xalloc.h (xmemdup): Do not mark with _GL_ATTRIBUTE_ALLOC, as this function can initialize the newly-allocated storage with new pointers, which means this function is not malloc-like. See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56955 --- ChangeLog | 8 ++++++++ lib/xalloc.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c91ac60ce7..488a0dad57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-05-20 Paul Eggert + + xalloc: don't potentially generate invalid code for xmemdup calls + * lib/xalloc.h (xmemdup): Do not mark with _GL_ATTRIBUTE_ALLOC, as + this function can initialize the newly-allocated storage with new + pointers, which means this function is not malloc-like. See: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56955 + 2014-05-19 Pádraig Brady getlogin_r-tests: avoid false failure under sudo/ssh etc. diff --git a/lib/xalloc.h b/lib/xalloc.h index 0bd6bce81c..3f6b5b80f8 100644 --- a/lib/xalloc.h +++ b/lib/xalloc.h @@ -64,7 +64,7 @@ void *xrealloc (void *p, size_t s) _GL_ATTRIBUTE_ALLOC_SIZE ((2)); void *x2realloc (void *p, size_t *pn); void *xmemdup (void const *p, size_t s) - _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((2)); + _GL_ATTRIBUTE_ALLOC_SIZE ((2)); char *xstrdup (char const *str) _GL_ATTRIBUTE_MALLOC; -- 2.39.5