Merge pull request #2751 from smcv/memdup2

Replace calls to g_memdup() with g_memdup2()
This commit is contained in:
Colin Walters 2022-11-13 10:50:39 -05:00 committed by GitHub
commit ba39acf942
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 6 deletions

View File

@ -4858,7 +4858,7 @@ _ostree_repo_import_object (OstreeRepo *self,
static OstreeRepoTransactionStats *
ostree_repo_transaction_stats_copy (OstreeRepoTransactionStats *stats)
{
return g_memdup (stats, sizeof (OstreeRepoTransactionStats));
return g_memdup2 (stats, sizeof (OstreeRepoTransactionStats));
}
static void

View File

@ -430,7 +430,7 @@ gboolean ostree_sign_ed25519_add_pk (OstreeSign *self,
if (g_list_find_custom (sign->public_keys, key, _compare_ed25519_keys) == NULL)
{
gpointer newkey = g_memdup (key, n_elements);
gpointer newkey = g_memdup2 (key, n_elements);
sign->public_keys = g_list_prepend (sign->public_keys, newkey);
}
@ -466,7 +466,7 @@ _ed25519_add_revoked (OstreeSign *self,
if (g_list_find_custom (sign->revoked_keys, key, _compare_ed25519_keys) == NULL)
{
gpointer newkey = g_memdup (key, n_elements);
gpointer newkey = g_memdup2 (key, n_elements);
sign->revoked_keys = g_list_prepend (sign->revoked_keys, newkey);
}

View File

@ -249,7 +249,7 @@ ot_gio_splice_get_checksum (GOutputStream *out,
guint8 digest[_OSTREE_SHA256_DIGEST_LEN];
ot_checksum_get_digest (&checksum, digest, sizeof (digest));
if (out_csum)
*out_csum = g_memdup (digest, sizeof (digest));
*out_csum = g_memdup2 (digest, sizeof (digest));
return TRUE;
}

View File

@ -43,7 +43,7 @@ GVariant *
ot_gvariant_new_bytearray (const guchar *data,
gsize len)
{
gpointer data_copy = g_memdup (data, len);
gpointer data_copy = g_memdup2 (data, len);
GVariant *ret = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), data_copy,
len, FALSE, g_free, data_copy);
return ret;

View File

@ -41,7 +41,7 @@ corrupt (GBytes *input)
const guint8 *buf = g_bytes_get_data (input, &len);
g_assert_cmpint (len, >, 0);
g_assert_cmpint (len, <, G_MAXINT);
g_autofree char *newbuf = g_memdup (buf, len);
g_autofree char *newbuf = g_memdup2 (buf, len);
g_assert (newbuf != NULL);
int o = g_random_int_range (0, len);
newbuf[o] = (newbuf[0] + 1);