Merge pull request #1943 from cgwalters/more-scan-build

More scan build
This commit is contained in:
OpenShift Merge Robot 2019-10-16 20:44:15 +02:00 committed by GitHub
commit 3b58d89368
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 9 deletions

View File

@ -313,6 +313,7 @@ cleanup_old_deployments (OstreeSysroot *self,
if (!list_all_deployment_directories (self, &all_deployment_dirs,
cancellable, error))
return FALSE;
g_assert (all_deployment_dirs); /* Pacify static analysis */
for (guint i = 0; i < all_deployment_dirs->len; i++)
{
OstreeDeployment *deployment = all_deployment_dirs->pdata[i];

View File

@ -945,6 +945,7 @@ ostree_sysroot_load_if_changed (OstreeSysroot *self,
g_autoptr(GPtrArray) deployments = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
g_assert (boot_loader_configs); /* Pacify static analysis */
for (guint i = 0; i < boot_loader_configs->len; i++)
{
OstreeBootconfigParser *config = boot_loader_configs->pdata[i];

View File

@ -772,8 +772,6 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
if (!skip_commit)
{
guint64 timestamp;
if (!opt_no_bindings)
{
g_autoptr(GVariant) old_metadata = g_steal_pointer (&metadata);
@ -782,10 +780,6 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
if (!opt_timestamp)
{
GDateTime *now = g_date_time_new_now_utc ();
timestamp = g_date_time_to_unix (now);
g_date_time_unref (now);
if (!ostree_repo_write_commit (repo, parent, opt_subject, commit_body, metadata,
OSTREE_REPO_FILE (root),
&commit_checksum, cancellable, error))
@ -800,8 +794,8 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
"Could not parse '%s'", opt_timestamp);
goto out;
}
timestamp = ts.tv_sec;
guint64 timestamp = ts.tv_sec;
if (!ostree_repo_write_commit_with_time (repo, parent, opt_subject, commit_body, metadata,
OSTREE_REPO_FILE (root),
timestamp,

View File

@ -434,6 +434,7 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation,
if (opt_add_tombstones)
{
guint i;
g_assert (tombstones); /* Pacify static analysis */
if (tombstones->len)
{
if (!ot_enable_tombstone_commits (repo, error))

View File

@ -205,7 +205,7 @@ ostree_builtin_prune (int argc, char **argv, OstreeCommandInvocation *invocation
g_autoptr(GHashTable) all_refs = NULL;
g_autoptr(GHashTable) reachable = ostree_repo_traverse_new_reachable ();
g_autoptr(GHashTable) retain_branch_depth = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
struct timespec keep_younger_than_ts;
struct timespec keep_younger_than_ts = {0, };
GHashTableIter hash_iter;
gpointer key, value;

View File

@ -125,7 +125,10 @@ dump_commit (GVariant *variant,
timestamp = GUINT64_FROM_BE (timestamp);
str = format_timestamp (timestamp, &local_error);
if (!str)
errx (1, "Failed to read commit: %s", local_error->message);
{
g_assert (local_error); /* Pacify static analysis */
errx (1, "Failed to read commit: %s", local_error->message);
}
g_autofree char *contents = ostree_commit_get_content_checksum (variant) ?: "<invalid commit>";
g_print ("ContentChecksum: %s\n", contents);
g_print ("Date: %s\n", str);