aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-05 09:22:02 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-05 09:22:02 +0000
commita01063165d8e8500f6a55f4abafe5e52f72e7596 (patch)
treeaef84cfc95375906bb755219cffc9e4e43f91a15 /include
parentdb63fd05601205a6e5c5fdd58aee52a0d5155385 (diff)
Merged revisions 192279 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r192279 | kpfleming | 2009-05-05 10:51:06 +0200 (Tue, 05 May 2009) | 5 lines Ensure that string pools allocated to hold stringfields are properly accounted in MALLOC_DEBUG mode This commit modifies the stringfield pool allocator to remember the 'owner' of the stringfield manager the pool is being allocated for, and ensures that pools allocated in the future when fields are populated are owned by that file/function. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@192298 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/stringfields.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/include/asterisk/stringfields.h b/include/asterisk/stringfields.h
index 9c48bfda2..f3b44fd94 100644
--- a/include/asterisk/stringfields.h
+++ b/include/asterisk/stringfields.h
@@ -138,6 +138,11 @@ struct ast_string_field_mgr {
size_t size; /*!< the total size of the current pool */
size_t used; /*!< the space used in the current pool */
ast_string_field last_alloc; /*!< the last field allocated */
+#if defined(__AST_DEBUG_MALLOC)
+ const char *owner_file; /*!< filename of owner */
+ const char *owner_func; /*!< function name of owner */
+ int owner_line; /*!< line number of owner */
+#endif
};
/*!
@@ -234,15 +239,18 @@ void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr,
\return 0 on success, non-zero on failure
*/
#define ast_string_field_init(x, size) \
- __ast_string_field_init(&(x)->__field_mgr, &(x)->__field_mgr_pool, size)
+ __ast_string_field_init(&(x)->__field_mgr, &(x)->__field_mgr_pool, size, __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*! \brief free all memory - to be called before destroying the object */
#define ast_string_field_free_memory(x) \
- __ast_string_field_init(&(x)->__field_mgr, &(x)->__field_mgr_pool, -1)
+ __ast_string_field_init(&(x)->__field_mgr, &(x)->__field_mgr_pool, -1, NULL, 0, NULL)
-/*! \internal \brief internal version of ast_string_field_init */
-int __ast_string_field_init(struct ast_string_field_mgr *mgr,
- struct ast_string_field_pool **pool_head, int needed);
+/*!
+ * \internal
+ * \brief internal version of ast_string_field_init
+ */
+int __ast_string_field_init(struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head,
+ int needed, const char *file, int lineno, const char *func);
/*!
\brief Set a field to a simple string value