diff options
author | Mike Ruprecht <mike.ruprecht@collabora.co.uk> | 2009-12-02 21:41:36 -0600 |
---|---|---|
committer | Mike Ruprecht <mike.ruprecht@collabora.co.uk> | 2009-12-02 21:41:36 -0600 |
commit | 0af825f8b18f3ab8bb4939cdc1de3cfff3cba7b7 (patch) | |
tree | 8fa5a193be9ebce9a40b4bd5cd8e04388754dcef /src | |
parent | 40473b675fe013d2eb141155d1507454d99686f9 (diff) |
Don't use self if it is NULL.
Upon discussion with Sjoerd I learned that it was possible for a GAsync
function to be cancelled, but still return a valid result. In this case, that
would mean the GabbleJingleFactory was disposed. With my previous assumption
that the error handler would have caught any condition where the factory was
NULL, this could have tried to access the disposed factory. This commit fixes
that assumption.
Diffstat (limited to 'src')
-rw-r--r-- | src/jingle-factory.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/jingle-factory.c b/src/jingle-factory.c index 7e53134a5..fec75d1b7 100644 --- a/src/jingle-factory.c +++ b/src/jingle-factory.c @@ -186,9 +186,7 @@ stun_server_resolved_cb (GObject *resolver, DEBUG ("Failed to resolve STUN server %s:%u: %s", data->stun_server, data->stun_port, e->message); g_error_free (e); - pending_stun_server_free (data); - g_object_unref (resolver); - return; + goto out; } stun_server = g_inet_address_to_string (entries->data); @@ -197,6 +195,12 @@ stun_server_resolved_cb (GObject *resolver, DEBUG ("Resolved STUN server %s:%u to %s:%u", data->stun_server, data->stun_port, stun_server, data->stun_port); + if (self == NULL) + { + g_free (stun_server); + goto out; + } + if (data->fallback) { g_free (self->priv->fallback_stun_server); @@ -210,6 +214,7 @@ stun_server_resolved_cb (GObject *resolver, self->priv->stun_port = data->stun_port; } +out: pending_stun_server_free (data); g_object_unref (resolver); } |