aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-05 09:15:13 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-05 09:15:13 +0000
commitbb03adc8d4713a0c7874ad852f6e1c0de1c8484a (patch)
tree4ce3470e8d4ee0ed435ac632a209a35d510832cb /include
parent5470af15d2fe866c80034b1c15911e2a6c610935 (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.1@192281 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