summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2010-11-03 18:43:18 +0000
committerTerry Wilson <twilson@digium.com>2010-11-03 18:43:18 +0000
commitabc94089cd818a9d6652d5de920e47070cc9f299 (patch)
treed22e8ad517174d0ed6ce95a06391ee40473b301e /channels
parentcbd42ce6eb3dffe4e6fdb59216ef94968ccf2bd4 (diff)
Merged revisions 293803 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r293803 | twilson | 2010-11-03 11:05:14 -0700 (Wed, 03 Nov 2010) | 25 lines Avoid valgrind warnings for ast_rtp_instance_get_xxx_address The documentation for ast_rtp_instance_get_(local/remote)_address stated that they returned 0 for success and -1 on failure. Instead, they returned 0 if the address structure passed in was already equivalent to the address instance local/remote address or 1 otherwise. 90% of the calls to these functions completely ignored the return address and passed in an uninitialized struct, which would make valgrind complain even though the operation was technically safe. This patch fixes the documentation and converts the get_xxx_address functions to void since all they really do is copy the address and cannot fail. Additionally two new functions (ast_rtp_instance_get_and_cmp_(local/remote)_address) are created for the 3 times where the return value was actually checked. The get_and_cmp_local_address function is currently unused, but exists for the sake of symmetry. The only functional change as a result of this change is that we will not do an ast_sockaddr_cmp() on (mostly uninitialized) addresses before doing the ast_sockaddr_copy() in the get_*_address functions. So, even though it is an API change, it shouldn't have a noticeable change in behavior. Review: https://reviewboard.asterisk.org/r/995/ ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@293809 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index a238fd5e6..7996154bd 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -27686,19 +27686,19 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *i
}
if (instance) {
- changed |= ast_rtp_instance_get_remote_address(instance, &p->redirip);
+ changed |= ast_rtp_instance_get_and_cmp_remote_address(instance, &p->redirip);
} else if (!ast_sockaddr_isnull(&p->redirip)) {
memset(&p->redirip, 0, sizeof(p->redirip));
changed = 1;
}
if (vinstance) {
- changed |= ast_rtp_instance_get_remote_address(vinstance, &p->vredirip);
+ changed |= ast_rtp_instance_get_and_cmp_remote_address(vinstance, &p->vredirip);
} else if (!ast_sockaddr_isnull(&p->vredirip)) {
memset(&p->vredirip, 0, sizeof(p->vredirip));
changed = 1;
}
if (tinstance) {
- changed |= ast_rtp_instance_get_remote_address(tinstance, &p->tredirip);
+ changed |= ast_rtp_instance_get_and_cmp_remote_address(tinstance, &p->tredirip);
} else if (!ast_sockaddr_isnull(&p->tredirip)) {
memset(&p->tredirip, 0, sizeof(p->tredirip));
changed = 1;