Fix issues flagged by static analyzers

These changes specifically fix the issues flagged by clang-analyzer.
Fixes: #59
This commit is contained in:
Dhanuka Warusadura 2021-03-31 13:02:32 +05:30 committed by Daiki Ueno
parent 127f326a2d
commit 7e713cf65a
3 changed files with 5 additions and 8 deletions

View File

@ -1560,8 +1560,6 @@ secret_collection_search_sync (SecretCollection *self,
if (paths == NULL)
return NULL;
ret = TRUE;
want = 1;
if (flags & SECRET_SEARCH_ALL)
want = G_MAXINT;

View File

@ -1140,9 +1140,6 @@ secret_service_open (GType service_gtype,
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
g_return_if_fail (g_type_is_a (service_gtype, SECRET_TYPE_SERVICE));
if (service_bus_name == NULL)
service_bus_name = get_default_bus_name ();
g_async_initable_new_async (service_gtype, G_PRIORITY_DEFAULT,
cancellable, callback, user_data,
"flags", flags,
@ -1217,9 +1214,6 @@ secret_service_open_sync (GType service_gtype,
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
g_return_val_if_fail (g_type_is_a (service_gtype, SECRET_TYPE_SERVICE), NULL);
if (service_bus_name == NULL)
service_bus_name = get_default_bus_name ();
return g_initable_new (service_gtype, cancellable, error,
"flags", flags,
NULL);

View File

@ -727,6 +727,7 @@ test_store_sync (Test *test,
ret = secret_service_store_sync (test->service, &MOCK_SCHEMA, attributes, collection_path,
"New Item Label", value, NULL, &error);
g_assert_true (ret);
g_assert_no_error (error);
secret_value_unref (value);
g_hash_table_unref (attributes);
@ -776,10 +777,12 @@ test_store_replace (Test *test,
ret = secret_service_store_sync (test->service, &MOCK_SCHEMA, attributes, collection_path,
"New Item Label", value, NULL, &error);
g_assert_true (ret);
g_assert_no_error (error);
ret = secret_service_store_sync (test->service, &MOCK_SCHEMA, attributes, collection_path,
"Another Label", value, NULL, &error);
g_assert_true (ret);
g_assert_no_error (error);
secret_value_unref (value);
g_hash_table_unref (attributes);
@ -829,6 +832,7 @@ test_store_async (Test *test,
egg_test_wait ();
ret = secret_service_store_finish (test->service, result, &error);
g_assert_true (ret);
g_assert_no_error (error);
g_object_unref (result);
@ -877,6 +881,7 @@ test_store_no_default (Test *test,
ret = secret_service_store_sync (test->service, &MOCK_SCHEMA, attributes, SECRET_COLLECTION_DEFAULT,
"New Item Label", value, NULL, &error);
g_assert_true (ret);
g_assert_no_error (error);
secret_value_unref (value);
g_hash_table_unref (attributes);