[asterisk-commits] may: branch may/ooh323_ipv6 r307678 - in /team/may/ooh323_ipv6: ./ addons/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Feb 12 17:28:05 CST 2011


Author: may
Date: Sat Feb 12 17:28:01 2011
New Revision: 307678

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=307678
Log:
Merged revisions 307677 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r307677 | may | 2011-02-13 02:25:58 +0300 (Sun, 13 Feb 2011) | 2 lines
  
  change malloc to ast_calloc calls to prevent crash of asterisk
........

Modified:
    team/may/ooh323_ipv6/   (props changed)
    team/may/ooh323_ipv6/addons/chan_ooh323.c
    team/may/ooh323_ipv6/addons/ooh323cDriver.c

Propchange: team/may/ooh323_ipv6/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Feb 12 17:28:01 2011
@@ -1,1 +1,1 @@
-/trunk:1-307560
+/trunk:1-307677

Modified: team/may/ooh323_ipv6/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/chan_ooh323.c?view=diff&rev=307678&r1=307677&r2=307678
==============================================================================
--- team/may/ooh323_ipv6/addons/chan_ooh323.c (original)
+++ team/may/ooh323_ipv6/addons/chan_ooh323.c Sat Feb 12 17:28:01 2011
@@ -686,7 +686,7 @@
 		ast_mutex_unlock(&iflock);
    	} else {
       		ast_mutex_lock(&p->lock);
-      		p->callToken = (char*)ast_malloc(AST_MAX_EXTENSION);
+      		p->callToken = (char*)ast_calloc(1, AST_MAX_EXTENSION);
       		if(!p->callToken) {
        			ast_mutex_unlock(&p->lock);
        			ast_mutex_lock(&iflock);
@@ -1419,7 +1419,7 @@
 
 	ast_mutex_lock(&p->lock);
 
-	ast_format_copy(&p->writeformat, fmt);
+	ast_format_copy(&(p->writeformat), fmt);
 
 	if (p->owner) {
 		while (p->owner && ast_channel_trylock(p->owner)) {
@@ -1477,7 +1477,7 @@
 
 	ast_mutex_lock(&p->lock);
 
-	ast_format_copy(&p->readformat, fmt);
+	ast_format_copy(&(p->readformat), fmt);
 
 	if (p->owner) {
 		while (p->owner && ast_channel_trylock(p->owner)) {
@@ -2184,7 +2184,7 @@
    	user = ast_calloc(1,sizeof(struct ooh323_user));
 	if (user) {
 		memset(user, 0, sizeof(struct ooh323_user));
-		if (!(user->cap = ast_format_cap_alloc_nolock())) {
+		if (!(user->cap = ast_format_cap_alloc())) {
 			ast_free(user);
 			return NULL;
 		}
@@ -2224,7 +2224,7 @@
 				if (user->rtptimeout < 0)
 					user->rtptimeout = gRTPTimeout;
 			} else if (!strcasecmp(v->name, "rtpmask")) {
-				if ((user->rtpmask = malloc(sizeof(struct OOH323Regex))) &&
+				if ((user->rtpmask = ast_calloc(1, sizeof(struct OOH323Regex))) &&
 					(regcomp(&user->rtpmask->regex, v->value, REG_EXTENDED) 
 											== 0)) {
 					ast_mutex_init(&user->rtpmask->lock);
@@ -2299,7 +2299,7 @@
 	peer = ast_calloc(1, sizeof(*peer));
 	if (peer) {
 		memset(peer, 0, sizeof(struct ooh323_peer));
-		if (!(peer->cap = ast_format_cap_alloc_nolock())) {
+		if (!(peer->cap = ast_format_cap_alloc())) {
 			ast_free(peer);
 			return NULL;
 		}
@@ -2374,7 +2374,7 @@
             			if(peer->rtptimeout < 0)
 					peer->rtptimeout = gRTPTimeout;
 			} else if (!strcasecmp(v->name, "rtpmask")) {
-				if ((peer->rtpmask = malloc(sizeof(struct OOH323Regex))) &&
+				if ((peer->rtpmask = ast_calloc(1, sizeof(struct OOH323Regex))) &&
 					(regcomp(&peer->rtpmask->regex, v->value, REG_EXTENDED) 
 											== 0)) {
 					ast_mutex_init(&peer->rtpmask->lock);
@@ -2615,7 +2615,7 @@
 			else 
 				ooH323EpTryBeMaster(0);
 		} else if (!strcasecmp(v->name, "h323id")) {
-         		pNewAlias = malloc(sizeof(struct ooAliases));
+         		pNewAlias = ast_calloc(1, sizeof(struct ooAliases));
 			if (!pNewAlias) {
 				ast_log(LOG_ERROR, "Failed to allocate memory for h323id alias\n");
 				return 1;
@@ -2629,7 +2629,7 @@
 			gAliasList = pNewAlias;
 			pNewAlias = NULL;
 		} else if (!strcasecmp(v->name, "e164")) {
-         		pNewAlias = malloc(sizeof(struct ooAliases));
+         		pNewAlias = ast_calloc(1, sizeof(struct ooAliases));
 			if (!pNewAlias) {
 				ast_log(LOG_ERROR, "Failed to allocate memory for e164 alias\n");
 				return 1;
@@ -2640,7 +2640,7 @@
 			gAliasList = pNewAlias;
 			pNewAlias = NULL;
 		} else if (!strcasecmp(v->name, "email")) {
-         		pNewAlias = malloc(sizeof(struct ooAliases));
+         		pNewAlias = ast_calloc(1, sizeof(struct ooAliases));
 			if (!pNewAlias) {
 				ast_log(LOG_ERROR, "Failed to allocate memory for email alias\n");
 				return 1;
@@ -3252,7 +3252,7 @@
 		.onModeChanged = onModeChanged
 	};
 	if (!(gCap = ast_format_cap_alloc())) {
-		return 1;
+		return 1; 
 	}
 	if (!(ooh323_tech.capabilities = ast_format_cap_alloc())) {
 		return 1;
@@ -4148,6 +4148,7 @@
 		memset(&p->udptlredirip, 0, sizeof(p->udptlredirip));
 
 	ast_mutex_unlock(&p->lock);
+	free(callToken);
 	return 0;
 }
 

Modified: team/may/ooh323_ipv6/addons/ooh323cDriver.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6/addons/ooh323cDriver.c?view=diff&rev=307678&r1=307677&r2=307678
==============================================================================
--- team/may/ooh323_ipv6/addons/ooh323cDriver.c (original)
+++ team/may/ooh323_ipv6/addons/ooh323cDriver.c Sat Feb 12 17:28:01 2011
@@ -145,7 +145,7 @@
 
 /* make new thread */
  if (cur == NULL) {
-	if (!(cur = ast_malloc(sizeof(struct callthread)))) {
+	if (!(cur = ast_calloc(1, sizeof(struct callthread)))) {
 		ast_log(LOG_ERROR, "Unable to allocate thread structure for call %s\n",
 							call->callToken);
 		return -1;




More information about the asterisk-commits mailing list