[asterisk-commits] rmudgett: trunk r262743 - /trunk/channels/chan_dahdi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 12 12:57:35 CDT 2010


Author: rmudgett
Date: Wed May 12 12:57:31 2010
New Revision: 262743

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=262743
Log:
Don't crash when destroying chan_dahdi pseudo channels.

Must do a deep copy of the cc_params in duplicate_pseudo().  Otherwise,
when the duplicate pseudo channel is destroyed, it frees the original
pseudo channel cc_params.  The original pseudo channel is then left with a
dangling pointer for when the next duplicated pseudo channel is created.

Modified:
    trunk/channels/chan_dahdi.c

Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=262743&r1=262742&r2=262743
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Wed May 12 12:57:31 2010
@@ -12427,6 +12427,15 @@
 		return NULL;
 	}
 	*p = *src;
+
+	/* Must deep copy the cc_params. */
+	p->cc_params = ast_cc_config_params_init();
+	if (!p->cc_params) {
+		ast_free(p);
+		return NULL;
+	}
+	ast_cc_copy_config_params(p->cc_params, src->cc_params);
+
 	p->which_iflist = DAHDI_IFLIST_NONE;
 	p->next = NULL;
 	p->prev = NULL;
@@ -17559,7 +17568,7 @@
 	struct ast_cc_config_params *cc_params;
 
 	cc_params = dest->chan.cc_params;
-	memcpy(dest, src, sizeof(dest));
+	*dest = *src;
 	dest->chan.cc_params = cc_params;
 	ast_cc_copy_config_params(dest->chan.cc_params, src->chan.cc_params);
 }




More information about the asterisk-commits mailing list