Merge pull request #1947 from cgwalters/more-scan-build-2

More scan build 2
This commit is contained in:
OpenShift Merge Robot authored and GitHub committed 2019-10-18 20:59:06 +02:00
commit 1645416aac
6 files changed
+22 -37

No files matched your search

+3 -3
View File
@@ -1588,7 +1588,6 @@ ostree_repo_prepare_transaction (OstreeRepo *self,
GCancellable *cancellable,
GError **error)
{
g_autoptr(_OstreeRepoAutoTransaction) txn = NULL;
guint64 reserved_bytes = 0;
g_return_val_if_fail (self->in_transaction == FALSE, FALSE);
@@ -1596,7 +1595,8 @@ ostree_repo_prepare_transaction (OstreeRepo *self,
g_debug ("Preparing transaction in repository %p", self);
/* Set up to abort the transaction if we return early from this function. */
txn = self;
g_autoptr(_OstreeRepoAutoTransaction) txn = self;
(void) txn; /* Add use to silence static analysis */
memset (&self->txn.stats, 0, sizeof (OstreeRepoTransactionStats));
@@ -1652,7 +1652,7 @@ ostree_repo_prepare_transaction (OstreeRepo *self,
return FALSE;
/* Success: do not abort the transaction when returning. */
txn = NULL;
txn = NULL; (void) txn;
if (out_transaction_resume)
*out_transaction_resume = ret_transaction_resume;
+1 -3
View File
@@ -2181,7 +2181,6 @@ static void
start_fetch (OtPullData *pull_data,
FetchObjectData *fetch)
{
gboolean is_meta;
g_autofree char *obj_subpath = NULL;
guint64 *expected_max_size_p;
guint64 expected_max_size;
@@ -2190,13 +2189,12 @@ start_fetch (OtPullData *pull_data,
GPtrArray *mirrorlist = NULL;
ostree_object_name_deserialize (fetch->object, &expected_checksum, &objtype);
is_meta = OSTREE_OBJECT_TYPE_IS_META (objtype);
g_debug ("starting fetch of %s.%s%s", expected_checksum,
ostree_object_type_to_string (objtype),
fetch->is_detached_meta ? " (detached)" : "");
is_meta = OSTREE_OBJECT_TYPE_IS_META (objtype);
gboolean is_meta = OSTREE_OBJECT_TYPE_IS_META (objtype);
if (is_meta)
pull_data->n_outstanding_metadata_fetches++;
else
+2 -3
View File
@@ -250,9 +250,8 @@ ot_gio_splice_get_checksum (GOutputStream *out,
guint8 digest[_OSTREE_SHA256_DIGEST_LEN];
ot_checksum_get_digest (&checksum, digest, sizeof (digest));
g_autofree guchar *ret_csum = g_malloc (sizeof (digest));
memcpy (ret_csum, digest, sizeof (digest));
ot_transfer_out_value (out_csum, &ret_csum);
if (out_csum)
*out_csum = g_memdup (digest, sizeof (digest));
return TRUE;
}
+7 -14
View File
@@ -1150,14 +1150,8 @@ ot_variant_builder_end (OtVariantBuilder *builder,
GError **error)
{
OtVariantBuilderInfo *info = builder->head;
gsize total_size;
gsize offset_size;
int i;
g_autofree guchar *offset_table = NULL;
gsize offset_table_size;
gboolean add_offset_table = FALSE;
gboolean reverse_offset_table = FALSE;
guchar *p;
g_return_val_if_fail (info->n_children >= info->min_items,
FALSE);
@@ -1188,15 +1182,14 @@ ot_variant_builder_end (OtVariantBuilder *builder,
if (add_offset_table)
{
total_size = gvs_calculate_total_size (info->offset, info->child_ends->len);
offset_size = gvs_get_offset_size (total_size);
offset_table_size = total_size - info->offset;
offset_table = g_malloc (offset_table_size);
p = offset_table;
const gsize total_size = gvs_calculate_total_size (info->offset, info->child_ends->len);
const gsize offset_size = gvs_get_offset_size (total_size);
const gsize offset_table_size = total_size - info->offset;
g_autofree guchar *offset_table = g_malloc (offset_table_size);
guchar *p = offset_table;
if (reverse_offset_table)
{
for (i = info->child_ends->len - 1; i >= 0; i--)
for (int i = info->child_ends->len - 1; i >= 0; i--)
{
gvs_write_unaligned_le (p, g_array_index (info->child_ends, guint64, i), offset_size);
p += offset_size;
@@ -1204,7 +1197,7 @@ ot_variant_builder_end (OtVariantBuilder *builder,
}
else
{
for (i = 0; i < info->child_ends->len; i++)
for (int i = 0; i < info->child_ends->len; i++)
{
gvs_write_unaligned_le (p, g_array_index (info->child_ends, guint64, i), offset_size);
p += offset_size;