Fix redefinition of local variable in gio/gdbusauthmechanismsha1.c

This commit is contained in:
Loic Le Page 2022-01-19 18:30:29 +01:00 committed by Loïc Le Page
parent c2b60e0323
commit eb157bfa1b

View File

@ -660,7 +660,7 @@ keyring_generate_entry (const gchar *cookie_context,
gchar *keyring_dir; gchar *keyring_dir;
gchar *path; gchar *path;
gchar *contents; gchar *contents;
GError *local_error; GError *local_error = NULL;
gchar **lines; gchar **lines;
gint max_line_id; gint max_line_id;
GString *new_contents; GString *new_contents;
@ -696,7 +696,6 @@ keyring_generate_entry (const gchar *cookie_context,
if (lock_fd == -1) if (lock_fd == -1)
goto out; goto out;
local_error = NULL;
contents = NULL; contents = NULL;
if (!g_file_get_contents (path, if (!g_file_get_contents (path,
&contents, &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) if (local_error->domain == G_FILE_ERROR && local_error->code == G_FILE_ERROR_NOENT)
{ {
/* file doesn't have to exist */ /* file doesn't have to exist */
g_error_free (local_error); g_clear_error (&local_error);
} }
else else
{ {
g_propagate_prefixed_error (error, g_propagate_prefixed_error (error,
local_error, g_steal_pointer (&local_error),
_("Error opening keyring “%s” for writing: "), _("Error opening keyring “%s” for writing: "),
path); path);
goto out; goto out;
@ -890,11 +889,11 @@ keyring_generate_entry (const gchar *cookie_context,
} }
out: out:
/* Any error should have been propagated to @error by now */
g_assert (local_error == NULL);
if (lock_fd != -1) if (lock_fd != -1)
{ {
GError *local_error;
local_error = NULL;
if (!keyring_release_lock (path, lock_fd, &local_error)) if (!keyring_release_lock (path, lock_fd, &local_error))
{ {
if (error != NULL) if (error != NULL)