diff options
author | Siraj Razick <siraj.razick@collabora.co.uk> | 2012-03-25 12:36:03 -0400 |
---|---|---|
committer | Siraj Razick <siraj.razick@collabora.co.uk> | 2012-03-26 10:31:35 -0400 |
commit | 51f7d9869d2fcb29f588fe7ba6c1954edbc08e9a (patch) | |
tree | 840cd7fdc195605613cd8fedaf9c3eef01f780eb | |
parent | a85536dcf3e76b285bd4a9ab45638df2e9eade95 (diff) | |
download | telepathy-salut-51f7d9869d2fcb29f588fe7ba6c1954edbc08e9a.tar.gz |
Avoid passing DNSServiceRef pointers between private structs.
This change is to avoid dereferencing dangling pointers, since we
are using pointers to DNSServiceRef in our mappings.
-rw-r--r-- | src/bonjour-contact-manager.c | 6 | ||||
-rw-r--r-- | src/bonjour-contact.c | 12 | ||||
-rw-r--r-- | src/bonjour-discovery-client.c | 15 | ||||
-rw-r--r-- | src/bonjour-discovery-client.h | 4 | ||||
-rw-r--r-- | src/bonjour-self.c | 6 |
5 files changed, 21 insertions, 22 deletions
diff --git a/src/bonjour-contact-manager.c b/src/bonjour-contact-manager.c index a10da1ef..569f6dd8 100644 --- a/src/bonjour-contact-manager.c +++ b/src/bonjour-contact-manager.c @@ -146,7 +146,7 @@ _salut_bonjour_service_browse_cb (DNSServiceRef service, { DEBUG ("Browser Failed with : (%d)", error_type); salut_bonjour_discovery_client_drop_svc_ref (priv->discovery_client, - &priv->presence_browser); + priv->presence_browser); return; } @@ -242,7 +242,7 @@ salut_bonjour_contact_manager_start (SalutContactManager *mgr, } salut_bonjour_discovery_client_watch_svc_ref (priv->discovery_client, - &priv->presence_browser); + priv->presence_browser); return TRUE; } @@ -266,7 +266,7 @@ salut_bonjour_contact_manager_close_all (SalutContactManager *mgr) SALUT_BONJOUR_CONTACT_MANAGER_GET_PRIVATE (self); salut_bonjour_discovery_client_drop_svc_ref (priv->discovery_client, - &priv->presence_browser); + priv->presence_browser); if (priv->discovery_client != NULL) { diff --git a/src/bonjour-contact.c b/src/bonjour-contact.c index 3bfefac6..a3091adf 100644 --- a/src/bonjour-contact.c +++ b/src/bonjour-contact.c @@ -380,7 +380,7 @@ salut_bonjour_contact_dispose (GObject *object) SalutBonjourResolveCtx *ctx = l->data; salut_bonjour_discovery_client_drop_svc_ref (priv->discovery_client, - &ctx->resolve_ref); + ctx->resolve_ref); g_slice_free (SalutBonjourResolveCtx, ctx); } @@ -469,7 +469,7 @@ _bonjour_getaddr_cb (DNSServiceRef service_ref, g_free (ctx->txt_record); ctx->txt_length = 0; salut_bonjour_discovery_client_drop_svc_ref (priv->discovery_client, - &ctx->address_ref); + ctx->address_ref); return; } @@ -481,7 +481,7 @@ _bonjour_getaddr_cb (DNSServiceRef service_ref, g_assert_not_reached (); salut_bonjour_discovery_client_drop_svc_ref (priv->discovery_client, - &ctx->address_ref); + ctx->address_ref); salut_contact_freeze (contact); @@ -602,7 +602,7 @@ _bonjour_service_resolve_cb (DNSServiceRef service_ref, } salut_bonjour_discovery_client_watch_svc_ref (priv->discovery_client, - &ctx->address_ref); + ctx->address_ref); } void @@ -621,7 +621,7 @@ salut_bonjour_contact_remove_service (SalutBonjourContact *self, return; salut_bonjour_discovery_client_drop_svc_ref (priv->discovery_client, - &ctx->resolve_ref); + ctx->resolve_ref); priv->resolvers = g_slist_remove (priv->resolvers, ctx); @@ -668,7 +668,7 @@ salut_bonjour_contact_add_service (SalutBonjourContact *self, } salut_bonjour_discovery_client_watch_svc_ref (priv->discovery_client, - &ctx->resolve_ref); + ctx->resolve_ref); priv->resolvers = g_slist_prepend (priv->resolvers, ctx); diff --git a/src/bonjour-discovery-client.c b/src/bonjour-discovery-client.c index 8e374e36..00b705a2 100644 --- a/src/bonjour-discovery-client.c +++ b/src/bonjour-discovery-client.c @@ -277,10 +277,10 @@ _bonjour_socket_process_cb (GIOChannel *source, GIOCondition condition, gpointer data) { - DNSServiceRef *service_ref = data; + DNSServiceRef service_ref = data; DNSServiceErrorType error_type = kDNSServiceErr_NoError; - error_type = DNSServiceProcessResult ((*service_ref)); + error_type = DNSServiceProcessResult (service_ref); if (error_type != kDNSServiceErr_NoError) { @@ -294,10 +294,9 @@ _bonjour_socket_process_cb (GIOChannel *source, static void _destroy_service (gpointer service_ptr) { - DNSServiceRef *service = service_ptr; + DNSServiceRef service = service_ptr; - if (service) - DNSServiceRefDeallocate (*service); + DNSServiceRefDeallocate (service); } static void @@ -317,7 +316,7 @@ _destroy_source_id (gpointer source_id) void salut_bonjour_discovery_client_watch_svc_ref (SalutBonjourDiscoveryClient *self, - DNSServiceRef *service) + DNSServiceRef service) { SalutBonjourDiscoveryClientPrivate *priv = SALUT_BONJOUR_DISCOVERY_CLIENT_GET_PRIVATE (self); @@ -326,7 +325,7 @@ salut_bonjour_discovery_client_watch_svc_ref (SalutBonjourDiscoveryClient *self, channel = g_io_channel_win32_new_socket ( - DNSServiceRefSockFD ((*service))); + DNSServiceRefSockFD ((service))); source_id = g_io_add_watch (channel, G_IO_IN, _bonjour_socket_process_cb, service); @@ -338,7 +337,7 @@ salut_bonjour_discovery_client_watch_svc_ref (SalutBonjourDiscoveryClient *self, void salut_bonjour_discovery_client_drop_svc_ref (SalutBonjourDiscoveryClient *self, - DNSServiceRef *service) + DNSServiceRef service) { SalutBonjourDiscoveryClientPrivate *priv = SALUT_BONJOUR_DISCOVERY_CLIENT_GET_PRIVATE (self); diff --git a/src/bonjour-discovery-client.h b/src/bonjour-discovery-client.h index a71d0be7..40798674 100644 --- a/src/bonjour-discovery-client.h +++ b/src/bonjour-discovery-client.h @@ -50,11 +50,11 @@ const gchar * salut_bonjour_discovery_client_get_dnssd_name ( void salut_bonjour_discovery_client_watch_svc_ref ( SalutBonjourDiscoveryClient *self, - DNSServiceRef *service); + DNSServiceRef service); void salut_bonjour_discovery_client_drop_svc_ref ( SalutBonjourDiscoveryClient *self, - DNSServiceRef *service); + DNSServiceRef service); /* TYPE MACROS */ #define SALUT_TYPE_BONJOUR_DISCOVERY_CLIENT \ diff --git a/src/bonjour-self.c b/src/bonjour-self.c index 395ce3e9..518db17b 100644 --- a/src/bonjour-self.c +++ b/src/bonjour-self.c @@ -286,7 +286,7 @@ _bonjour_service_register_cb (DNSServiceRef service_ref, { DEBUG ("Service Registration Failed with : (%d)", error_type); salut_bonjour_discovery_client_drop_svc_ref (priv->discovery_client, - &priv->bonjour_service); + priv->bonjour_service); } else { @@ -341,7 +341,7 @@ salut_bonjour_self_announce (SalutSelf *_self, RETURN_ERROR_IF_FAIL (error_type, error); salut_bonjour_discovery_client_watch_svc_ref (priv->discovery_client, - &priv->bonjour_service); + priv->bonjour_service); return TRUE; } @@ -546,7 +546,7 @@ salut_bonjour_self_dispose (GObject *object) priv->dispose_has_run = TRUE; salut_bonjour_discovery_client_drop_svc_ref (priv->discovery_client, - &priv->bonjour_service); + priv->bonjour_service); if (priv->discovery_client != NULL) { |