[Asterisk-cvs] asterisk/channels chan_iax2.c, 1.188.2.4, 1.188.2.5 chan_sip.c, 1.510.2.10, 1.510.2.11 chan_zap.c, 1.344.2.5, 1.344.2.6 iax2-parser.c, 1.27, 1.27.2.1

citats at lists.digium.com citats at lists.digium.com
Mon Oct 25 13:53:54 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv27408/channels

Modified Files:
      Tag: v1-0
	chan_iax2.c chan_sip.c chan_zap.c iax2-parser.c 
Log Message:
Backport recent memory fixes to 1.0

Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.188.2.4
retrieving revision 1.188.2.5
diff -u -d -r1.188.2.4 -r1.188.2.5
--- chan_iax2.c	14 Oct 2004 22:43:35 -0000	1.188.2.4
+++ chan_iax2.c	25 Oct 2004 17:57:25 -0000	1.188.2.5
@@ -536,12 +536,12 @@
 static void iax_debug_output(const char *data)
 {
 	if (iaxdebug)
-		ast_verbose(data);
+		ast_verbose("%s", data);
 }
 
 static void iax_error_output(const char *data)
 {
-	ast_log(LOG_WARNING, data);
+	ast_log(LOG_WARNING, "%s", data);
 }
 
 /* XXX We probably should use a mutex when working with this XXX */
@@ -6399,9 +6399,11 @@
  	} else {
 		ast_mutex_unlock(&peerl.lock);
 		peer = malloc(sizeof(struct iax2_peer));
-		memset(peer, 0, sizeof(struct iax2_peer));
-		peer->expire = -1;
-		peer->pokeexpire = -1;
+		if (peer) {
+			memset(peer, 0, sizeof(struct iax2_peer));
+			peer->expire = -1;
+			peer->pokeexpire = -1;
+		}
 	}
 	if (peer) {
 		peer->messagedetail = globalmessagedetail;
@@ -6566,7 +6568,8 @@
  	} else {
 		ast_mutex_unlock(&userl.lock);
 		user = malloc(sizeof(struct iax2_user));
-		memset(user, 0, sizeof(struct iax2_user));
+		if (user)
+			memset(user, 0, sizeof(struct iax2_user));
 	}
 	
 	if (user) {

Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.510.2.10
retrieving revision 1.510.2.11
diff -u -d -r1.510.2.10 -r1.510.2.11
--- chan_sip.c	24 Oct 2004 21:04:32 -0000	1.510.2.10
+++ chan_sip.c	25 Oct 2004 17:57:25 -0000	1.510.2.11
@@ -8222,6 +8222,8 @@
 {
 	struct sip_peer *peer;
 	peer = malloc(sizeof(struct sip_peer));
+	if (!peer)
+		return NULL;
 	memset(peer, 0, sizeof(struct sip_peer));
 	peer->expire = -1;
 	peer->pokeexpire = -1;
@@ -8282,12 +8284,14 @@
  	} else {
 		ast_mutex_unlock(&peerl.lock);
 		peer = malloc(sizeof(struct sip_peer));
-		memset(peer, 0, sizeof(struct sip_peer));
-		peer->expire = -1;
-		peer->pokeexpire = -1;
+		if (peer) {
+			memset(peer, 0, sizeof(struct sip_peer));
+			peer->expire = -1;
+			peer->pokeexpire = -1;
+		}
 	}
-	peer->lastmsgssent = -1;
 	if (peer) {
+		peer->lastmsgssent = -1;
 		if (!found) {
 			strncpy(peer->name, name, sizeof(peer->name)-1);
 			strncpy(peer->context, default_context, sizeof(peer->context)-1);

Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.344.2.5
retrieving revision 1.344.2.6
diff -u -d -r1.344.2.5 -r1.344.2.6
--- chan_zap.c	25 Oct 2004 00:18:06 -0000	1.344.2.5
+++ chan_zap.c	25 Oct 2004 17:57:25 -0000	1.344.2.6
@@ -7125,7 +7125,7 @@
 
 static void zt_pri_message(char *s)
 {
-	ast_verbose(s);
+	ast_verbose("%s", s);
 }
 
 static void zt_pri_error(char *s)

Index: iax2-parser.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/iax2-parser.c,v
retrieving revision 1.27
retrieving revision 1.27.2.1
diff -u -d -r1.27 -r1.27.2.1
--- iax2-parser.c	9 Sep 2004 01:36:01 -0000	1.27
+++ iax2-parser.c	25 Oct 2004 17:57:25 -0000	1.27.2.1
@@ -32,7 +32,7 @@
 
 static void internaloutput(const char *str)
 {
-	printf(str);
+	fputs(str, stdout);
 }
 
 static void internalerror(const char *str)




More information about the svn-commits mailing list