int wmesh_gdbus_set_passphrase(wmesh_service *service, wmesh_scan_result_s *info, gchar *passphrase)
{
+ int ret = WMESHD_ERROR_NONE;
GVariant *variant = NULL;
+ GVariant *var_passphrase = NULL;
GError *error = NULL;
wmeshd_check_null_ret_error("service", service, WMESHD_ERROR_INVALID_PARAMETER);
wmeshd_check_null_ret_error("passphrase", passphrase, WMESHD_ERROR_INVALID_PARAMETER);
+ var_passphrase = g_variant_new_string(passphrase);
variant = g_dbus_connection_call_sync(service->connection,
CONNMAN_SERVER_NAME,
info->object_path,
CONNMAN_INTERFACE_MESH,
"SetProperty",
- g_variant_new("(sv)", "Passphrase", g_variant_new_string(passphrase)),
+ g_variant_new("(sv)", "Passphrase", var_passphrase),
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1, NULL, &error);
} else if (error) {
WMESH_LOGE("Failed DBus call [%s]", error->message);
g_error_free(error);
- return WMESHD_ERROR_IO_ERROR;
+ ret = WMESHD_ERROR_IO_ERROR;
}
-
- return WMESHD_ERROR_NONE;
+ g_variant_unref(var_passphrase);
+ return ret;
}
#if 0