[Asterisk-cvs] asterisk/channels chan_mgcp.c,1.79.2.14,1.79.2.15

russell at lists.digium.com russell at lists.digium.com
Tue May 31 00:36:13 CDT 2005


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

Modified Files:
      Tag: v1-0
	chan_mgcp.c 
Log Message:
fix a mem leak (bug #4154)


Index: chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.79.2.14
retrieving revision 1.79.2.15
diff -u -d -r1.79.2.14 -r1.79.2.15
--- chan_mgcp.c	15 May 2005 15:55:30 -0000	1.79.2.14
+++ chan_mgcp.c	31 May 2005 04:39:24 -0000	1.79.2.15
@@ -1235,9 +1235,9 @@
 static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state)
 {
 	struct ast_channel *tmp;
-    struct mgcp_endpoint *i = sub->parent;
+	struct mgcp_endpoint *i = sub->parent;
 	int fmt;
-    i = sub->parent;
+	
 	tmp = ast_channel_alloc(1);
 	if (tmp) {
 		tmp->nativeformats = i->capability;
@@ -1675,14 +1675,13 @@
 
         /* Next, scan through each "a=rtpmap:" line, noting each
          specified RTP payload type (with corresponding MIME subtype): */
-        sdpLineNum_iterator_init(&iterator);
-        while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') {
-          char* mimeSubtype = strdup(a); // ensures we have enough space
-          if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2) continue;
-          /* Note: should really look at the 'freq' and '#chans' params too */
-          ast_rtp_set_rtpmap_type(sub->rtp, codec, "audio", mimeSubtype);
-	  free(mimeSubtype);
-        }
+	sdpLineNum_iterator_init(&iterator);
+	while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') {
+		char* mimeSubtype = ast_strdupa(a); /* ensures we have enough space */          
+		if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2) continue;
+		/* Note: should really look at the 'freq' and '#chans' params too */
+		ast_rtp_set_rtpmap_type(sub->rtp, codec, "audio", mimeSubtype);
+	}
 
         /* Now gather all of the codecs that were asked for: */
         ast_rtp_get_current_formats(sub->rtp,




More information about the svn-commits mailing list