[libsecret: 1/3] Fix issues flagged by static analyzers




commit 7e713cf65aaf42af3bc9ae0457675766a08e1df0
Author: Dhanuka Warusadura <csx tuta io>
Date:   Wed Mar 31 13:02:32 2021 +0530

    Fix issues flagged by static analyzers
    
    These changes specifically fix the issues flagged by clang-analyzer.
    Fixes: #59

 libsecret/secret-collection.c | 2 --
 libsecret/secret-service.c    | 6 ------
 libsecret/test-methods.c      | 5 +++++
 3 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/libsecret/secret-collection.c b/libsecret/secret-collection.c
index 4e27422..5e3378d 100644
--- a/libsecret/secret-collection.c
+++ b/libsecret/secret-collection.c
@@ -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;
diff --git a/libsecret/secret-service.c b/libsecret/secret-service.c
index c2abbc2..455248c 100644
--- a/libsecret/secret-service.c
+++ b/libsecret/secret-service.c
@@ -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);
diff --git a/libsecret/test-methods.c b/libsecret/test-methods.c
index a1cc595..121ebd5 100644
--- a/libsecret/test-methods.c
+++ b/libsecret/test-methods.c
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]