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 /src/bonjour-discovery-client.c | |
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.
Diffstat (limited to 'src/bonjour-discovery-client.c')
-rw-r--r-- | src/bonjour-discovery-client.c | 15 |
1 files changed, 7 insertions, 8 deletions
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); |