[glib: 2/11] Fix redefinition of local variable in gio/gdbusauthmechanismsha1.c
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/11] Fix redefinition of local variable in gio/gdbusauthmechanismsha1.c
- Date: Fri, 1 Apr 2022 15:13:33 +0000 (UTC)
commit eb157bfa1b975b7ba9a8fa4a4aeb10903d946ed0
Author: Loic Le Page <llepage fluendo com>
Date: Wed Jan 19 18:30:29 2022 +0100
Fix redefinition of local variable in gio/gdbusauthmechanismsha1.c
gio/gdbusauthmechanismsha1.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/gio/gdbusauthmechanismsha1.c b/gio/gdbusauthmechanismsha1.c
index 8137b6352d..b10e537c5e 100644
--- a/gio/gdbusauthmechanismsha1.c
+++ b/gio/gdbusauthmechanismsha1.c
@@ -660,7 +660,7 @@ keyring_generate_entry (const gchar *cookie_context,
gchar *keyring_dir;
gchar *path;
gchar *contents;
- GError *local_error;
+ GError *local_error = NULL;
gchar **lines;
gint max_line_id;
GString *new_contents;
@@ -696,7 +696,6 @@ keyring_generate_entry (const gchar *cookie_context,
if (lock_fd == -1)
goto out;
- local_error = NULL;
contents = NULL;
if (!g_file_get_contents (path,
&contents,
@@ -706,12 +705,12 @@ keyring_generate_entry (const gchar *cookie_context,
if (local_error->domain == G_FILE_ERROR && local_error->code == G_FILE_ERROR_NOENT)
{
/* file doesn't have to exist */
- g_error_free (local_error);
+ g_clear_error (&local_error);
}
else
{
g_propagate_prefixed_error (error,
- local_error,
+ g_steal_pointer (&local_error),
_("Error opening keyring ā%sā for writing: "),
path);
goto out;
@@ -890,11 +889,11 @@ keyring_generate_entry (const gchar *cookie_context,
}
out:
+ /* Any error should have been propagated to @error by now */
+ g_assert (local_error == NULL);
if (lock_fd != -1)
{
- GError *local_error;
- local_error = NULL;
if (!keyring_release_lock (path, lock_fd, &local_error))
{
if (error != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]