chan_sip: Fix reference leaks in error paths.
authorCorey Farrell <git@cfware.com>
Sat, 9 Jul 2016 18:32:27 +0000 (14:32 -0400)
committerCorey Farrell <git@cfware.com>
Sat, 9 Jul 2016 18:39:01 +0000 (13:39 -0500)
commitad30d60c692b53eeb305ee6ee166a108144d03bb
treec92d006900919ff742f760d56f47bcd02c6e4e64
parente0f27ecabb2ff766ea4ec7bdd77fccab2fe826c4
chan_sip: Fix reference leaks in error paths.

* get_sip_pvt_from_replaces leaks sip_pvt_ptr on any error.
* build_peer leaks peer on failure to allocate the endpoint.

This patch fixes get_sip_pvt by using an RAII_VAR, build_peer is fixed
with an unref in the appropriate place.

ASTERISK-26184 #close

Change-Id: I728b424648ad041409f7d90880f4c28b3ce2ca12
channels/chan_sip.c