[asterisk-commits] file: trunk r187772 - in /trunk: channels/ main/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 10 13:02:48 CDT 2009


Author: file
Date: Fri Apr 10 13:02:44 2009
New Revision: 187772

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=187772
Log:
Fix some uninitialized memory notices that appeared under valgrind.

Modified:
    trunk/channels/chan_gtalk.c
    trunk/channels/chan_h323.c
    trunk/channels/chan_jingle.c
    trunk/channels/chan_mgcp.c
    trunk/channels/chan_sip.c
    trunk/channels/chan_skinny.c
    trunk/channels/chan_unistim.c
    trunk/main/rtp_engine.c
    trunk/res/res_rtp_asterisk.c

Modified: trunk/channels/chan_gtalk.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_gtalk.c?view=diff&rev=187772&r1=187771&r2=187772
==============================================================================
--- trunk/channels/chan_gtalk.c (original)
+++ trunk/channels/chan_gtalk.c Fri Apr 10 13:02:44 2009
@@ -770,7 +770,7 @@
 	struct gtalk_candidate *tmp;
 	struct aji_client *c = client->connection;
 	struct gtalk_candidate *ours1 = NULL, *ours2 = NULL;
-	struct sockaddr_in sin;
+	struct sockaddr_in sin = { 0, };
 	struct sockaddr_in dest;
 	struct in_addr us;
 	iks *iq, *gtalk, *candidate, *transport;
@@ -1254,8 +1254,8 @@
 	struct gtalk_candidate *tmp;
 	struct hostent *hp;
 	struct ast_hostent ahp;
-	struct sockaddr_in sin;
-	struct sockaddr_in aux;
+	struct sockaddr_in sin = { 0, };
+	struct sockaddr_in aux = { 0, };
 
 	if (time(NULL) == p->laststun)
 		return 0;

Modified: trunk/channels/chan_h323.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_h323.c?view=diff&rev=187772&r1=187771&r2=187772
==============================================================================
--- trunk/channels/chan_h323.c (original)
+++ trunk/channels/chan_h323.c Fri Apr 10 13:02:44 2009
@@ -3163,8 +3163,8 @@
 {
 	/* XXX Deal with Video */
 	struct oh323_pvt *pvt;
-	struct sockaddr_in them;
-	struct sockaddr_in us;
+	struct sockaddr_in them = { 0, };
+	struct sockaddr_in us = { 0, };
 	char *mode;
 
 	if (!rtp) {

Modified: trunk/channels/chan_jingle.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_jingle.c?view=diff&rev=187772&r1=187771&r2=187772
==============================================================================
--- trunk/channels/chan_jingle.c (original)
+++ trunk/channels/chan_jingle.c Fri Apr 10 13:02:44 2009
@@ -577,7 +577,7 @@
 	struct jingle_candidate *tmp;
 	struct aji_client *c = client->connection;
 	struct jingle_candidate *ours1 = NULL, *ours2 = NULL;
-	struct sockaddr_in sin;
+	struct sockaddr_in sin = { 0, };
 	struct sockaddr_in dest;
 	struct in_addr us;
 	struct in_addr externaddr;

Modified: trunk/channels/chan_mgcp.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_mgcp.c?view=diff&rev=187772&r1=187771&r2=187772
==============================================================================
--- trunk/channels/chan_mgcp.c (original)
+++ trunk/channels/chan_mgcp.c Fri Apr 10 13:02:44 2009
@@ -2057,7 +2057,7 @@
 	char m[256] = "";
 	char a[1024] = "";
 	int x;
-	struct sockaddr_in dest;
+	struct sockaddr_in dest = { 0, };
 	struct mgcp_endpoint *p = sub->parent;
 	/* XXX We break with the "recommendation" and send our IP, in order that our
 	       peer doesn't have to ast_gethostbyname() us XXX */

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=187772&r1=187771&r2=187772
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Apr 10 13:02:44 2009
@@ -7752,7 +7752,7 @@
 		if (udptlportno > 0) {
 			sin.sin_port = htons(udptlportno);
 			if (ast_test_flag(&p->flags[0], SIP_NAT) && ast_test_flag(&p->flags[1], SIP_PAGE2_UDPTL_DESTINATION)) {
-				struct sockaddr_in remote_address;
+				struct sockaddr_in remote_address = { 0, };
 				ast_rtp_instance_get_remote_address(p->rtp, &remote_address);
 				if (remote_address.sin_addr.s_addr) {
 					memcpy(&sin, &remote_address, sizeof(sin));
@@ -9382,11 +9382,11 @@
 	int len = 0;
 	int alreadysent = 0;
 
-	struct sockaddr_in sin;
-	struct sockaddr_in vsin;
-	struct sockaddr_in tsin;
-	struct sockaddr_in dest;
-	struct sockaddr_in udptlsin;
+	struct sockaddr_in sin = { 0, };
+	struct sockaddr_in vsin = { 0, };
+	struct sockaddr_in tsin = { 0, };
+	struct sockaddr_in dest = { 0, };
+	struct sockaddr_in udptlsin = { 0, };
 	struct sockaddr_in vdest = { 0, };
 	struct sockaddr_in tdest = { 0, };
 	struct sockaddr_in udptldest = { 0, };

Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=187772&r1=187771&r2=187772
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Fri Apr 10 13:02:44 2009
@@ -2651,8 +2651,8 @@
 	struct skinny_device *d;
 	struct skinnysession *s;
 	struct ast_format_list fmt;
-	struct sockaddr_in us;
-	struct sockaddr_in them;
+	struct sockaddr_in us = { 0, };
+	struct sockaddr_in them = { 0, };
 	struct skinny_req *req;
 	
 	sub = c->tech_pvt;
@@ -5564,8 +5564,8 @@
 	struct skinny_line *l;
 	struct skinny_subchannel *sub;
 	struct ast_format_list fmt;
-	struct sockaddr_in sin;
-	struct sockaddr_in us;
+	struct sockaddr_in sin = { 0, };
+	struct sockaddr_in us = { 0, };
 	uint32_t addr;
 	int port;
 	int status;

Modified: trunk/channels/chan_unistim.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_unistim.c?view=diff&rev=187772&r1=187771&r2=187772
==============================================================================
--- trunk/channels/chan_unistim.c (original)
+++ trunk/channels/chan_unistim.c Fri Apr 10 13:02:44 2009
@@ -2027,11 +2027,11 @@
 static void start_rtp(struct unistim_subchannel *sub)
 {
 	BUFFSEND;
-	struct sockaddr_in us;
-	struct sockaddr_in public;
-	struct sockaddr_in sin;
+	struct sockaddr_in us = { 0, };
+	struct sockaddr_in public = { 0, };
+	struct sockaddr_in sin = { 0, };
 	int codec;
-	struct sockaddr_in sout;
+	struct sockaddr_in sout = { 0, };
 
 	/* Sanity checks */
 	if (!sub) {

Modified: trunk/main/rtp_engine.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/main/rtp_engine.c?view=diff&rev=187772&r1=187771&r2=187772
==============================================================================
--- trunk/main/rtp_engine.c (original)
+++ trunk/main/rtp_engine.c Fri Apr 10 13:02:44 2009
@@ -1433,7 +1433,7 @@
 
 char *ast_rtp_instance_get_quality(struct ast_rtp_instance *instance, enum ast_rtp_instance_stat_field field, char *buf, size_t size)
 {
-	struct ast_rtp_instance_stats stats;
+	struct ast_rtp_instance_stats stats = { 0, };
 	enum ast_rtp_instance_stat stat;
 
 	/* Determine what statistics we will need to retrieve based on field passed in */

Modified: trunk/res/res_rtp_asterisk.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/res/res_rtp_asterisk.c?view=diff&rev=187772&r1=187771&r2=187772
==============================================================================
--- trunk/res/res_rtp_asterisk.c (original)
+++ trunk/res/res_rtp_asterisk.c Fri Apr 10 13:02:44 2009
@@ -473,7 +473,7 @@
 static int ast_rtp_dtmf_begin(struct ast_rtp_instance *instance, char digit)
 {
 	struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
-	struct sockaddr_in remote_address;
+	struct sockaddr_in remote_address = { 0, };
 	int hdrlen = 12, res = 0, i = 0, payload = 101;
 	char data[256];
 	unsigned int *rtpheader = (unsigned int*)data;
@@ -542,7 +542,7 @@
 static int ast_rtp_dtmf_continuation(struct ast_rtp_instance *instance)
 {
 	struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
-	struct sockaddr_in remote_address;
+	struct sockaddr_in remote_address = { 0, };
 	int hdrlen = 12, res = 0;
 	char data[256];
 	unsigned int *rtpheader = (unsigned int*)data;
@@ -585,7 +585,7 @@
 static int ast_rtp_dtmf_end(struct ast_rtp_instance *instance, char digit)
 {
 	struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
-	struct sockaddr_in remote_address;
+	struct sockaddr_in remote_address = { 0, };
 	int hdrlen = 12, res = 0, i = 0;
 	char data[256];
 	unsigned int *rtpheader = (unsigned int*)data;
@@ -938,7 +938,7 @@
 	struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
 	int pred, mark = 0;
 	unsigned int ms = calc_txstamp(rtp, &frame->delivery);
-	struct sockaddr_in remote_address;
+	struct sockaddr_in remote_address = { 0, };
 
 	if (rtp->sending_digit) {
 		return 0;
@@ -1086,7 +1086,7 @@
 static int ast_rtp_write(struct ast_rtp_instance *instance, struct ast_frame *frame)
 {
 	struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
-	struct sockaddr_in remote_address;
+	struct sockaddr_in remote_address = { 0, };
 	int codec, subclass;
 
 	ast_rtp_instance_get_remote_address(instance, &remote_address);
@@ -1263,7 +1263,7 @@
 static struct ast_frame *send_dtmf(struct ast_rtp_instance *instance, enum ast_frame_type type, int compensate)
 {
 	struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
-	struct sockaddr_in remote_address;
+	struct sockaddr_in remote_address = { 0, };
 
 	ast_rtp_instance_get_remote_address(instance, &remote_address);
 
@@ -1292,7 +1292,7 @@
 static struct ast_frame *process_dtmf_rfc2833(struct ast_rtp_instance *instance, unsigned char *data, int len, unsigned int seqno, unsigned int timestamp, struct sockaddr_in *sin, int payloadtype, int mark)
 {
 	struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
-	struct sockaddr_in remote_address;
+	struct sockaddr_in remote_address = { 0, };
 	unsigned int event, event_end, samples;
 	char resp = 0;
 	struct ast_frame *f = NULL;
@@ -1450,7 +1450,7 @@
 		ast_debug(0, "- RTP 3389 Comfort noise event: Level %d (len = %d)\n", rtp->lastrxformat, len);
 
 	if (ast_test_flag(rtp, FLAG_3389_WARNING)) {
-		struct sockaddr_in remote_address;
+		struct sockaddr_in remote_address = { 0, };
 
 		ast_rtp_instance_get_remote_address(instance, &remote_address);
 
@@ -1749,7 +1749,7 @@
 	int res = 0, payload = 0, bridged_payload = 0, mark;
 	struct ast_rtp_payload_type payload_type;
 	int reconstruct = ntohl(rtpheader[0]);
-	struct sockaddr_in remote_address;
+	struct sockaddr_in remote_address = { 0, };
 
 	/* Get fields from packet */
 	payload = (reconstruct & 0x7f0000) >> 16;
@@ -1806,7 +1806,7 @@
 	int res, hdrlen = 12, version, payloadtype, padding, mark, ext, cc, prev_seqno;
 	unsigned int *rtpheader = (unsigned int*)(rtp->rawdata + AST_FRIENDLY_OFFSET), seqno, ssrc, timestamp;
 	struct ast_rtp_payload_type payload;
-	struct sockaddr_in remote_address;
+	struct sockaddr_in remote_address = { 0, };
 
 	/* If this is actually RTCP let's hop on over and handle it */
 	if (rtcp) {




More information about the asterisk-commits mailing list