[svn-commits] rmudgett: branch rmudgett/dahdi_ccss r240270 - /team/rmudgett/dahdi_ccss/chan...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jan 14 16:39:39 CST 2010


Author: rmudgett
Date: Thu Jan 14 16:39:37 2010
New Revision: 240270

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=240270
Log:
Made sig_pri_cc_agent_destructor() check if private_data is NULL.

Also it would be nice if the destructor did the unlock before freeing the
private data.

Modified:
    team/rmudgett/dahdi_ccss/channels/chan_dahdi.c
    team/rmudgett/dahdi_ccss/channels/sig_pri.c

Modified: team/rmudgett/dahdi_ccss/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/channels/chan_dahdi.c?view=diff&rev=240270&r1=240269&r2=240270
==============================================================================
--- team/rmudgett/dahdi_ccss/channels/chan_dahdi.c (original)
+++ team/rmudgett/dahdi_ccss/channels/chan_dahdi.c Thu Jan 14 16:39:37 2010
@@ -4641,7 +4641,6 @@
 		set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->rxdrc, p->txdrc, p->law);
 	}	
 
-/* BUGBUG need to figure out how to do a CC recall call. */
 #ifdef HAVE_PRI
 	if (dahdi_sig_pri_lib_handles(p->sig)) {
 		struct dahdi_params ps;

Modified: team/rmudgett/dahdi_ccss/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_ccss/channels/sig_pri.c?view=diff&rev=240270&r1=240269&r2=240270
==============================================================================
--- team/rmudgett/dahdi_ccss/channels/sig_pri.c (original)
+++ team/rmudgett/dahdi_ccss/channels/sig_pri.c Thu Jan 14 16:39:37 2010
@@ -5292,6 +5292,10 @@
  * The core will call this function upon completion
  * or failure of CC.
  *
+ * \note
+ * The agent private_data pointer may be NULL if the agent
+ * constructor failed.
+ *
  * \return Nothing
  */
 void sig_pri_cc_agent_destructor(struct ast_cc_agent *agent)
@@ -5300,6 +5304,10 @@
 	int res;
 
 	cc_pvt = agent->private_data;
+	if (!cc_pvt) {
+		/* The agent constructor probably failed. */
+		return;
+	}
 	ast_mutex_lock(&cc_pvt->pri->lock);
 	res = -1;
 	if (cc_pvt->cc_request_response_pending) {
@@ -5308,8 +5316,8 @@
 	if (res) {
 		pri_cc_cancel(cc_pvt->pri->pri, cc_pvt->cc_id);
 	}
+	ast_mutex_unlock(&cc_pvt->pri->lock);
 	ast_free(cc_pvt);
-	ast_mutex_unlock(&cc_pvt->pri->lock);
 }
 #endif	/* defined(HAVE_PRI_CCSS) */
 




More information about the svn-commits mailing list