[asterisk-commits] blanchet: branch group/v6 r85132 - /team/group/v6/trunk/main/rtp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 9 10:43:29 CDT 2007


Author: blanchet
Date: Tue Oct  9 10:43:29 2007
New Revision: 85132

URL: http://svn.digium.com/view/asterisk?view=rev&rev=85132
Log:
sizeof arg fix less prone to changes of struct definitions.

Modified:
    team/group/v6/trunk/main/rtp.c

Modified: team/group/v6/trunk/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/group/v6/trunk/main/rtp.c?view=diff&rev=85132&r1=85131&r2=85132
==============================================================================
--- team/group/v6/trunk/main/rtp.c (original)
+++ team/group/v6/trunk/main/rtp.c Tue Oct  9 10:43:29 2007
@@ -2234,8 +2234,8 @@
 	if (!(rtcp = ast_calloc(1, sizeof(*rtcp))))
 		return NULL;
 	rtcp->s = rtp_socket(af);
-	memset(&rtcp->us, 0, sizeof(struct sockaddr_storage));
-	memset(&rtcp->them, 0, sizeof(struct sockaddr_storage));
+	memset(&rtcp->us, 0, sizeof(rtcp->us));
+	memset(&rtcp->them, 0, sizeof(rtcp->them));
 	rtcp->uslen = 0;
 	rtcp->themlen = 0;
 
@@ -2257,8 +2257,8 @@
 	ast_mutex_init(&rtp->bridge_lock);
 #endif
 
-	memset(&rtp->us, 0, sizeof(struct sockaddr_storage));
-	memset(&rtp->them, 0, sizeof(struct sockaddr_storage));
+	memset(&rtp->us, 0, sizeof(rtp->us));
+	memset(&rtp->them, 0, sizeof(rtp->them));
 	rtp->uslen = 0;
 	rtp->themlen = 0;
 	rtp->ssrc = ast_random();
@@ -2399,7 +2399,7 @@
 			memcpy(them, &rtp->them, rtp->themlen);
 			*themlen = rtp->themlen;
 		} else {
-			memset(them, 0, sizeof(struct sockaddr_storage));
+			memset(them, 0, sizeof(*them));
 			*themlen = 0;
 		}
 		return 1;
@@ -2413,7 +2413,7 @@
 		memcpy(us, &rtp->us, rtp->uslen);
 		*uslen = rtp->uslen;
 	} else {
-		memset(us, 0, sizeof(struct sockaddr_storage));
+		memset(us, 0, sizeof(*us));
 		*uslen = 0;
 	}
 }




More information about the asterisk-commits mailing list