Merge pull request #2751 from smcv/memdup2
Replace calls to g_memdup() with g_memdup2()
This commit is contained in:
commit
ba39acf942
|
|
@ -4858,7 +4858,7 @@ _ostree_repo_import_object (OstreeRepo *self,
|
||||||
static OstreeRepoTransactionStats *
|
static OstreeRepoTransactionStats *
|
||||||
ostree_repo_transaction_stats_copy (OstreeRepoTransactionStats *stats)
|
ostree_repo_transaction_stats_copy (OstreeRepoTransactionStats *stats)
|
||||||
{
|
{
|
||||||
return g_memdup (stats, sizeof (OstreeRepoTransactionStats));
|
return g_memdup2 (stats, sizeof (OstreeRepoTransactionStats));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -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)
|
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);
|
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)
|
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);
|
sign->revoked_keys = g_list_prepend (sign->revoked_keys, newkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ ot_gio_splice_get_checksum (GOutputStream *out,
|
||||||
guint8 digest[_OSTREE_SHA256_DIGEST_LEN];
|
guint8 digest[_OSTREE_SHA256_DIGEST_LEN];
|
||||||
ot_checksum_get_digest (&checksum, digest, sizeof (digest));
|
ot_checksum_get_digest (&checksum, digest, sizeof (digest));
|
||||||
if (out_csum)
|
if (out_csum)
|
||||||
*out_csum = g_memdup (digest, sizeof (digest));
|
*out_csum = g_memdup2 (digest, sizeof (digest));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ GVariant *
|
||||||
ot_gvariant_new_bytearray (const guchar *data,
|
ot_gvariant_new_bytearray (const guchar *data,
|
||||||
gsize len)
|
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,
|
GVariant *ret = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), data_copy,
|
||||||
len, FALSE, g_free, data_copy);
|
len, FALSE, g_free, data_copy);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ corrupt (GBytes *input)
|
||||||
const guint8 *buf = g_bytes_get_data (input, &len);
|
const guint8 *buf = g_bytes_get_data (input, &len);
|
||||||
g_assert_cmpint (len, >, 0);
|
g_assert_cmpint (len, >, 0);
|
||||||
g_assert_cmpint (len, <, G_MAXINT);
|
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);
|
g_assert (newbuf != NULL);
|
||||||
int o = g_random_int_range (0, len);
|
int o = g_random_int_range (0, len);
|
||||||
newbuf[o] = (newbuf[0] + 1);
|
newbuf[o] = (newbuf[0] + 1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue