summaryrefslogtreecommitdiff
path: root/gdhcp/client.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-07-25 11:56:38 -0700
committerMarcel Holtmann <marcel@holtmann.org>2010-07-25 11:56:38 -0700
commitc4fd43a4ca1de3665407abe852a9a81ecdb1dd88 (patch)
treee6fa74a733d4cc79f1e7f2016f222aba171d876d /gdhcp/client.c
parent4faa2bedac24a8332f007f3f90219a156ccd444f (diff)
downloadconnman-c4fd43a4ca1de3665407abe852a9a81ecdb1dd88.tar.gz
connman-c4fd43a4ca1de3665407abe852a9a81ecdb1dd88.tar.bz2
connman-c4fd43a4ca1de3665407abe852a9a81ecdb1dd88.zip
Fix wrong prototype for DHCP client library reference counting
Diffstat (limited to 'gdhcp/client.c')
-rw-r--r--gdhcp/client.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gdhcp/client.c b/gdhcp/client.c
index 7be3d3d7..2e9fe6f0 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -1204,13 +1204,21 @@ GDHCPClientError g_dhcp_client_set_send(GDHCPClient *dhcp_client,
return G_DHCP_CLIENT_ERROR_NONE;
}
-void g_dhcp_client_ref(GDHCPClient *dhcp_client)
+GDHCPClient *g_dhcp_client_ref(GDHCPClient *dhcp_client)
{
+ if (dhcp_client == NULL)
+ return NULL;
+
g_atomic_int_inc(&dhcp_client->ref_count);
+
+ return dhcp_client;
}
void g_dhcp_client_unref(GDHCPClient *dhcp_client)
{
+ if (dhcp_client == NULL)
+ return;
+
if (g_atomic_int_dec_and_test(&dhcp_client->ref_count) == FALSE)
return;
@@ -1231,6 +1239,9 @@ void g_dhcp_client_unref(GDHCPClient *dhcp_client)
void g_dhcp_client_set_debug(GDHCPClient *dhcp_client,
GDHCPDebugFunc func, gpointer data)
{
+ if (dhcp_client == NULL)
+ return;
+
dhcp_client->debug_func = func;
dhcp_client->debug_data = data;
}