From 1eab48363ba385cba5d57aa09e5a7218d12f25b5 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 18 Aug 2020 23:34:57 +0000 Subject: [PATCH 1/2] pull: Assign idle_src variable before calling unref() This should pacify Coverity, and also just "reads" better too. --- src/libostree/ostree-repo-pull.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 894e4b1f..d817575b 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -436,8 +436,9 @@ ensure_idle_queued (OtPullData *pull_data) idle_src = g_idle_source_new (); g_source_set_callback (idle_src, idle_worker, pull_data, NULL); g_source_attach (idle_src, pull_data->main_context); - g_source_unref (idle_src); pull_data->idle_src = idle_src; + /* Ownership is transferred to pull_data */ + g_source_unref (idle_src); } typedef struct { From 95a751262251b7f8137efb828e9c4825d91cad34 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 18 Aug 2020 23:35:38 +0000 Subject: [PATCH 2/2] prepare-root: Remove unused variable Should quiet Coverity. --- src/switchroot/ostree-prepare-root.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c index 8a68e1f4..f7e4fe47 100644 --- a/src/switchroot/ostree-prepare-root.c +++ b/src/switchroot/ostree-prepare-root.c @@ -101,10 +101,9 @@ sysroot_is_configured_ro (const char *sysroot) bool ret = false; char *line = NULL; size_t len = 0; - ssize_t nread; /* Note getline() will reuse the previous buffer */ bool in_sysroot = false; - while ((nread = getline (&line, &len, f)) != -1) + while (getline (&line, &len, f) != -1) { /* This is an awful hack to avoid depending on GLib in the * initramfs right now.