<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8518">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/18/8518/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 393c020..7b406e5 100644<br>--- a/include/asterisk/channel.h<br>+++ b/include/asterisk/channel.h<br>@@ -1098,7 +1098,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>@@ -1157,7 +1157,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 8f59fd3..e920fc0b 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 0e0d20a..81575ac 100644<br>--- a/include/asterisk/stringfields.h<br>+++ b/include/asterisk/stringfields.h<br>@@ -443,7 +443,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 876e53c..290f7a3 100644<br>--- a/include/asterisk/utils.h<br>+++ b/include/asterisk/utils.h<br>@@ -610,7 +610,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>diff --git a/main/channel.c b/main/channel.c<br>index 48963c7..70e0bff 100644<br>--- a/main/channel.c<br>+++ b/main/channel.c<br>@@ -790,7 +790,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 690d06e..97cfaa9 100644<br>--- a/utils/extconf.c<br>+++ b/utils/extconf.c<br>@@ -816,7 +816,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/8518">change 8518</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/8518"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </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: 8518 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>