diff options
author | Gary Kramlich <grim@reaperworld.com> | 2017-09-22 02:39:51 +0000 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2017-09-22 02:39:51 +0000 |
commit | 50ff3402ff8103d7c932df74632c49c8fe5aa8ef (patch) | |
tree | cc7732365ece136e52e20b14a070a6a609264872 | |
parent | 172d78f04d8ae8ba3ee3c8174302f723178d22ee (diff) | |
parent | 182c375893496f9c567697c308786246556e99a4 (diff) | |
download | pidgin-50ff3402ff8103d7c932df74632c49c8fe5aa8ef.tar.gz |
Merged in eblanton/pidgin/release-2.x.y (pull request #266)
jabber: Avoid a use-after-free in an error path
Approved-by: Gary Kramlich <grim@reaperworld.com>
Approved-by: Ethan Blanton <elb@kb8ojh.net>
Approved-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
-rw-r--r-- | libpurple/protocols/jabber/jingle/rtp.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/libpurple/protocols/jabber/jingle/rtp.c b/libpurple/protocols/jabber/jingle/rtp.c index 876b80fb36..05cb2cb1bb 100644 --- a/libpurple/protocols/jabber/jingle/rtp.c +++ b/libpurple/protocols/jabber/jingle/rtp.c @@ -950,6 +950,7 @@ jingle_rtp_initiate_media(JabberStream *js, const gchar *who, JingleTransport *transport; JabberBuddy *jb; JabberBuddyResource *jbr; + gboolean ret = FALSE; const gchar *transport_type; gchar *resource = NULL, *me = NULL, *sid = NULL; @@ -958,16 +959,15 @@ jingle_rtp_initiate_media(JabberStream *js, const gchar *who, jb = jabber_buddy_find(js, who, FALSE); if (!jb) { purple_debug_error("jingle-rtp", "Could not find Jabber buddy\n"); - return FALSE; + goto out; } resource = jabber_get_resource(who); jbr = jabber_buddy_find_resource(jb, resource); - g_free(resource); if (!jbr) { purple_debug_error("jingle-rtp", "Could not find buddy's resource - %s\n", resource); - return FALSE; + goto out; } if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_ICEUDP)) { @@ -977,7 +977,7 @@ jingle_rtp_initiate_media(JabberStream *js, const gchar *who, } else { purple_debug_error("jingle-rtp", "Resource doesn't support " "the same transport types\n"); - return FALSE; + goto out; } /* set ourselves as initiator */ @@ -985,7 +985,6 @@ jingle_rtp_initiate_media(JabberStream *js, const gchar *who, sid = jabber_get_next_id(js); session = jingle_session_create(js, sid, me, who, TRUE); - g_free(sid); if (type & PURPLE_MEDIA_AUDIO) { @@ -1005,13 +1004,17 @@ jingle_rtp_initiate_media(JabberStream *js, const gchar *who, jingle_rtp_init_media(content); } - g_free(me); - if (jingle_rtp_get_media(session) == NULL) { - return FALSE; + goto out; } - return TRUE; + ret = TRUE; + +out: + g_free(me); + g_free(resource); + g_free(sid); + return ret; } void |