lib: Avoid dereferencing NULL error values

Otherwise, this will segfault when callers don't need any exact errors.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
This commit is contained in:
Ryan Gonzalez 2021-11-11 18:07:06 -06:00
parent e39280ff21
commit 9c1fe55bbc
2 changed files with 16 additions and 6 deletions

View File

@ -457,9 +457,15 @@ ostree_repo_static_delta_execute_offline_with_signature (OstreeRepo *self,
if (sign)
{
verified = _ostree_repo_static_delta_verify_signature (self, meta_fd, sign, NULL, error);
if (*error)
return FALSE;
g_autoptr(GError) local_error = NULL;
verified = _ostree_repo_static_delta_verify_signature (self, meta_fd, sign, NULL, &local_error);
if (local_error != NULL)
{
g_propagate_error (error, g_steal_pointer (&local_error));
return FALSE;
}
if (!verified)
return glnx_throw (error, "Delta signature verification failed");
}

View File

@ -487,12 +487,16 @@ _load_pk_from_stream (OstreeSign *self,
while (TRUE)
{
gsize len = 0;
g_autofree char *line = g_data_input_stream_read_line (key_data_in, &len, NULL, error);
g_autoptr (GVariant) pk = NULL;
gboolean added = FALSE;
g_autoptr(GError) local_error = NULL;
g_autofree char *line = g_data_input_stream_read_line (key_data_in, &len, NULL, &local_error);
if (*error != NULL)
return FALSE;
if (local_error != NULL)
{
g_propagate_error (error, g_steal_pointer (&local_error));
return FALSE;
}
if (line == NULL)
return ret;