]> Savannah Git Hosting - gnulib.git/commitdiff
xalloc: don't potentially generate invalid code for xmemdup calls
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 21 May 2014 01:14:48 +0000 (18:14 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 21 May 2014 01:15:10 +0000 (18:15 -0700)
* 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
lib/xalloc.h

index c91ac60ce7bc1ce601a48f0bfecbfc4795bd61a4..488a0dad5724517fa167cc906978f8d05f0875ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-05-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <P@draigBrady.com>
 
        getlogin_r-tests: avoid false failure under sudo/ssh etc.
index 0bd6bce81c2c79b873e51dee48c841a1f12ecdb1..3f6b5b80f8dd2b7188b2adca4333d856575799e0 100644 (file)
@@ -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;