[svn-commits] mmichelson: branch group/CCSS r213183 - in /team/group/CCSS: channels/ includ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 19 17:42:47 CDT 2009


Author: mmichelson
Date: Wed Aug 19 17:42:43 2009
New Revision: 213183

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=213183
Log:
Fix memory leaks and make debugging memory leaks easier.


Modified:
    team/group/CCSS/channels/chan_sip.c
    team/group/CCSS/include/asterisk/ccss.h
    team/group/CCSS/main/ccss.c
    team/group/CCSS/main/channel.c

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=213183&r1=213182&r2=213183
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Wed Aug 19 17:42:43 2009
@@ -4571,6 +4571,8 @@
 		peer->socket.tcptls_session = NULL;
 	}
 
+	ast_cc_config_params_destroy(peer->cc_params);
+
 	ast_string_field_free_memory(peer);
 }
 
@@ -5531,6 +5533,8 @@
 	}
 
 	ast_string_field_free_memory(p);
+
+	ast_cc_config_params_destroy(p->cc_params);
 
 	if (p->socket.tcptls_session) {
 		ao2_ref(p->socket.tcptls_session, -1);

Modified: team/group/CCSS/include/asterisk/ccss.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/include/asterisk/ccss.h?view=diff&rev=213183&r1=213182&r2=213183
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Wed Aug 19 17:42:43 2009
@@ -125,7 +125,9 @@
  * \retval NULL Unable to allocate the structure
  * \retval non-NULL A pointer to the newly allocated and initialized structure
  */
-struct ast_cc_config_params *ast_cc_config_params_init(void);
+struct ast_cc_config_params *__ast_cc_config_params_init(const char *file, int line, const char *function);
+
+#define ast_cc_config_params_init() __ast_cc_config_params_init(__FILE__, __LINE__, __PRETTY_FUNCTION__)
 
 /*!
  * \brief Free memory from CCSS configuration params

Modified: team/group/CCSS/main/ccss.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=213183&r1=213182&r2=213183
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Wed Aug 19 17:42:43 2009
@@ -26,6 +26,7 @@
 #include "asterisk/ccss.h"
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
+#include "asterisk/utils.h"
 
 /*!
  * \since 1.6.4
@@ -52,9 +53,13 @@
 static const unsigned int CC_MAX_AGENTS_DEFAULT = 5u;
 static const unsigned int CC_MAX_MONITORS_DEFAULT = 5u;
 
-struct ast_cc_config_params *ast_cc_config_params_init(void)
-{
+struct ast_cc_config_params *__ast_cc_config_params_init(const char *file, int line, const char *function)
+{
+#if defined(__AST_DEBUG_MALLOC)
+	struct ast_cc_config_params *params = __ast_calloc(1, sizeof(*params), file, line, function);
+#else
 	struct ast_cc_config_params *params = ast_calloc(1, sizeof(*params));
+#endif
 
 	if (!params) {
 		return NULL;

Modified: team/group/CCSS/main/channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/channel.c?view=diff&rev=213183&r1=213182&r2=213183
==============================================================================
--- team/group/CCSS/main/channel.c (original)
+++ team/group/CCSS/main/channel.c Wed Aug 19 17:42:43 2009
@@ -7088,7 +7088,7 @@
 int ast_channel_cc_params_init(struct ast_channel *chan,
 		const struct ast_cc_config_params *base_params)
 {
-	struct ast_cc_config_params *cc_params = ast_cc_config_params_init();
+	struct ast_cc_config_params *cc_params;
 	struct ast_datastore *cc_datastore;
 
 	if (!(cc_params = ast_cc_config_params_init())) {




More information about the svn-commits mailing list