<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8519">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">core: Remove incorrect usage of attribute_malloc.<br><br>GCC documentation states that when __attribute__((malloc)) is used it<br>should not return storage which contains any valid pointers.  It<br>specifically mentions that realloc functions should not have the malloc<br>attribute, but this also means that complex initializers which could<br>contain initialized pointers should not use this attribute.<br><br>Change-Id: If507f33ffb3ca3b83b702196eb0e8215d27fc7d2<br>---<br>M include/asterisk/channel.h<br>M include/asterisk/datastore.h<br>M include/asterisk/stringfields.h<br>M include/asterisk/utils.h<br>M main/channel.c<br>M utils/extconf.c<br>6 files changed, 7 insertions(+), 7 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/19/8519/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h<br>index 3dfbe61..8cb0380 100644<br>--- a/include/asterisk/channel.h<br>+++ b/include/asterisk/channel.h<br>@@ -1149,7 +1149,7 @@<br>  * \deprecated You should use the ast_datastore_alloc() generic function instead.<br>  * \version 1.6.1 deprecated<br>  */<br>-struct ast_datastore * attribute_malloc ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)<br>+struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)<br>         __attribute__((deprecated));<br> <br> /*!<br>@@ -1208,7 +1208,7 @@<br>  *       and "default" context.<br>  * \note Since 12.0.0 this function returns with the newly created channel locked.<br>  */<br>-struct ast_channel * attribute_malloc __attribute__((format(printf, 15, 16)))<br>+struct ast_channel * __attribute__((format(printf, 15, 16)))<br>    __ast_channel_alloc(int needqueue, int state, const char *cid_num,<br>            const char *cid_name, const char *acctcode,<br>           const char *exten, const char *context, const struct ast_assigned_ids *assignedids,<br>diff --git a/include/asterisk/datastore.h b/include/asterisk/datastore.h<br>index 85e9c68..b776c5f 100644<br>--- a/include/asterisk/datastore.h<br>+++ b/include/asterisk/datastore.h<br>@@ -80,7 +80,7 @@<br>  * \param file, line, function<br>  * \version 1.6.1 moved here and renamed from ast_channel_datastore_alloc<br>  */<br>-struct ast_datastore * attribute_malloc __ast_datastore_alloc(const struct ast_datastore_info *info, const char *uid,<br>+struct ast_datastore *__ast_datastore_alloc(const struct ast_datastore_info *info, const char *uid,<br>                                                            const char *file, int line, const char *function);<br> <br> #define ast_datastore_alloc(info, uid) __ast_datastore_alloc(info, uid, __FILE__, __LINE__, __PRETTY_FUNCTION__)<br>diff --git a/include/asterisk/stringfields.h b/include/asterisk/stringfields.h<br>index 69f2fcc..a4e1fce 100644<br>--- a/include/asterisk/stringfields.h<br>+++ b/include/asterisk/stringfields.h<br>@@ -434,7 +434,7 @@<br>  * \internal<br>  * \brief internal version of ast_calloc_with_stringfields<br>  */<br>-void * attribute_malloc __ast_calloc_with_stringfields(unsigned int num_structs,<br>+void *__ast_calloc_with_stringfields(unsigned int num_structs,<br>        size_t struct_size, size_t field_mgr_offset, size_t field_mgr_pool_offset, size_t pool_size,<br>  const char *file, int lineno, const char *func);<br> <br>diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h<br>index c6c3407..798caab 100644<br>--- a/include/asterisk/utils.h<br>+++ b/include/asterisk/utils.h<br>@@ -563,7 +563,7 @@<br> )<br> <br> AST_INLINE_API(<br>-void * attribute_malloc __ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),<br>+void *__ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),<br> {<br>      void *newp;<br> <br>diff --git a/main/channel.c b/main/channel.c<br>index c71d19b..2779aa8 100644<br>--- a/main/channel.c<br>+++ b/main/channel.c<br>@@ -782,7 +782,7 @@<br> }<br> <br> /*! \brief Create a new channel structure */<br>-static struct ast_channel * attribute_malloc __attribute__((format(printf, 15, 0)))<br>+static struct ast_channel *__attribute__((format(printf, 15, 0)))<br> __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char *cid_name,<br>                   const char *acctcode, const char *exten, const char *context, const struct ast_assigned_ids *assignedids,<br>                     const struct ast_channel *requestor, enum ama_flags amaflag, struct ast_endpoint *endpoint,<br>diff --git a/utils/extconf.c b/utils/extconf.c<br>index 1be739c..5b3a95b 100644<br>--- a/utils/extconf.c<br>+++ b/utils/extconf.c<br>@@ -780,7 +780,7 @@<br>  __ast_realloc((p), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)<br> <br> AST_INLINE_API(<br>-void * attribute_malloc __ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),<br>+void *__ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),<br> {<br>         void *newp;<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8519">change 8519</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8519"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: If507f33ffb3ca3b83b702196eb0e8215d27fc7d2 </div>
<div style="display:none"> Gerrit-Change-Number: 8519 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>