]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
core: Remove incorrect usage of attribute_malloc.
authorCorey Farrell <git@cfware.com>
Tue, 13 Mar 2018 21:37:12 +0000 (17:37 -0400)
committerCorey Farrell <git@cfware.com>
Tue, 13 Mar 2018 21:37:12 +0000 (17:37 -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 393c020fc9065b9f891b2a9a20f7534abcdc0373..7b406e52bd24a7aec8545fcfc468eb1a46663b34 100644 (file)
@@ -1098,7 +1098,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));
 
 /*!
@@ -1157,7 +1157,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 8f59fd3cf7e332165af222ce9ee719bbb643dc2d..e920fc0b8395883d785328302ec730a4c624e976 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 0e0d20acaf95a38b08706b8db621181a5456f3eb..81575ac2dfb84538e699c411a33a4144db58d1f1 100644 (file)
@@ -443,7 +443,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 876e53c293ae65aa0a4516974e4a53cde89187fd..290f7a30e3fade7178680866f290f2d2e4e26164 100644 (file)
@@ -610,7 +610,7 @@ void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, in
        _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;
 
index 48963c7292917858338d3a027423f0ed03d5ddc5..70e0bff8d5e1ef82ec1f3bfb6ade07955ef60a0e 100644 (file)
@@ -790,7 +790,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 690d06e7c63f4f433ba4120131abd02bd03a2664..97cfaa9a68b427051ff9d47948c5f2a000a46f73 100644 (file)
@@ -816,7 +816,7 @@ void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, in
        _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;