]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
core: Remove incorrect usage of attribute_malloc.
authorCorey Farrell <git@cfware.com>
Tue, 13 Mar 2018 20:53:24 +0000 (16:53 -0400)
committerCorey Farrell <git@cfware.com>
Tue, 13 Mar 2018 20:53:24 +0000 (16:53 -0400)
GCC documentation states that when __attribute__((malloc)) is used it
should not return storage which contains any valid pointers.  It
specifically mentions that realloc functions should not have the malloc
attribute, but this also means that complex initializers which could
contain initialized pointers should not use this attribute.

Change-Id: If507f33ffb3ca3b83b702196eb0e8215d27fc7d2

include/asterisk/channel.h
include/asterisk/datastore.h
include/asterisk/stringfields.h
include/asterisk/utils.h
main/channel.c
utils/extconf.c

index 3dfbe61d9061f29f56f539da832153f5ac0506ba..8cb03800ecabadbae6f847f027d595166489d71e 100644 (file)
@@ -1149,7 +1149,7 @@ enum ama_flags {
  * \deprecated You should use the ast_datastore_alloc() generic function instead.
  * \version 1.6.1 deprecated
  */
-struct ast_datastore * attribute_malloc ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
+struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
        __attribute__((deprecated));
 
 /*!
@@ -1208,7 +1208,7 @@ struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const
  *       and "default" context.
  * \note Since 12.0.0 this function returns with the newly created channel locked.
  */
-struct ast_channel * attribute_malloc __attribute__((format(printf, 15, 16)))
+struct ast_channel * __attribute__((format(printf, 15, 16)))
        __ast_channel_alloc(int needqueue, int state, const char *cid_num,
                const char *cid_name, const char *acctcode,
                const char *exten, const char *context, const struct ast_assigned_ids *assignedids,
index 85e9c6890ac326e3bb4ca018c40e81efbcda4f6e..b776c5f5770129f789c3fc90aa7d02ef5f614ea3 100644 (file)
@@ -80,7 +80,7 @@ struct ast_datastore {
  * \param file, line, function
  * \version 1.6.1 moved here and renamed from ast_channel_datastore_alloc
  */
-struct ast_datastore * attribute_malloc __ast_datastore_alloc(const struct ast_datastore_info *info, const char *uid,
+struct ast_datastore *__ast_datastore_alloc(const struct ast_datastore_info *info, const char *uid,
                                                              const char *file, int line, const char *function);
 
 #define ast_datastore_alloc(info, uid) __ast_datastore_alloc(info, uid, __FILE__, __LINE__, __PRETTY_FUNCTION__)
index 69f2fcca4d1e807eb2c95da1c979db844c959276..a4e1fceeac797808276dbaf42c21febb53345df3 100644 (file)
@@ -434,7 +434,7 @@ int __ast_string_field_init(struct ast_string_field_mgr *mgr, struct ast_string_
  * \internal
  * \brief internal version of ast_calloc_with_stringfields
  */
-void * attribute_malloc __ast_calloc_with_stringfields(unsigned int num_structs,
+void *__ast_calloc_with_stringfields(unsigned int num_structs,
        size_t struct_size, size_t field_mgr_offset, size_t field_mgr_pool_offset, size_t pool_size,
        const char *file, int lineno, const char *func);
 
index c6c34074e00a9419ed4b32da6d744f4eaf8d5870..798caabc563c28cd7fb916cbdf8ace33cf8ea7a1 100644 (file)
@@ -563,7 +563,7 @@ void * attribute_malloc __ast_calloc(size_t num, size_t len, const char *file, i
 )
 
 AST_INLINE_API(
-void * attribute_malloc __ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),
+void *__ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),
 {
        void *newp;
 
index c71d19b81f92fd773cd6b2314257617b8d80282c..2779aa8279b7d77351f8826f6ea3b840b751f634 100644 (file)
@@ -782,7 +782,7 @@ static int does_id_conflict(const char *uniqueid)
 }
 
 /*! \brief Create a new channel structure */
-static struct ast_channel * attribute_malloc __attribute__((format(printf, 15, 0)))
+static struct ast_channel *__attribute__((format(printf, 15, 0)))
 __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char *cid_name,
                       const char *acctcode, const char *exten, const char *context, const struct ast_assigned_ids *assignedids,
                       const struct ast_channel *requestor, enum ama_flags amaflag, struct ast_endpoint *endpoint,
index 1be739c177f2647c40780d16f80dddaaebe92789..5b3a95be9c4d5ddc77a351f159471490fa15ca4a 100644 (file)
@@ -780,7 +780,7 @@ void * attribute_malloc __ast_calloc(size_t num, size_t len, const char *file, i
        __ast_realloc((p), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
 
 AST_INLINE_API(
-void * attribute_malloc __ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),
+void *__ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),
 {
        void *newp;