if (gdbus_conn.conn_ref_count < 1)
return;
- g_object_unref(gdbus_conn.connection);
+ if (gdbus_conn.connection)
+ g_object_unref(gdbus_conn.connection);
if (__sync_sub_and_fetch(&gdbus_conn.conn_ref_count, 1) < 1 &&
gdbus_conn.handle_libnetwork != NULL) {
if (gdbus_conn.conn_ref_count < 1) {
WIFI_LOG(WIFI_INFO, "There is no pending call");
-
- g_object_unref(gdbus_conn.connection);
- gdbus_conn.connection = NULL;
} else {
WIFI_LOG(WIFI_ERROR,
"There are %d pending calls, waiting to be cleared",
WIFI_LOG(WIFI_ERROR, "A handle of libnetwork is not NULL");
gdbus_conn.handle_libnetwork = dlopen("/usr/lib/libnetwork.so", RTLD_LAZY);
-
- g_object_unref(gdbus_conn.connection);
}
+ g_object_unref(gdbus_conn.connection);
+ g_clear_object(&gdbus_conn.connection);
+
return NET_ERR_NONE;
}