mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-07 14:12:59 +00:00
trivial: Use g_memdup2() on new glib2 versions to avoid a warning
This commit is contained in:
parent
9b11af985f
commit
5294d0c7c0
@ -2040,8 +2040,6 @@ fu_memcpy_safe (guint8 *dst, gsize dst_sz, gsize dst_offset,
|
|||||||
guint8 *
|
guint8 *
|
||||||
fu_memdup_safe (const guint8 *src, gsize n, GError **error)
|
fu_memdup_safe (const guint8 *src, gsize n, GError **error)
|
||||||
{
|
{
|
||||||
g_autofree guint8 *dst = NULL;
|
|
||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
if (n > 0x40000000) {
|
if (n > 0x40000000) {
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
@ -2052,13 +2050,12 @@ fu_memdup_safe (const guint8 *src, gsize n, GError **error)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if GLIB_CHECK_VERSION(2,67,3)
|
||||||
/* linear block of memory */
|
/* linear block of memory */
|
||||||
dst = g_malloc (n);
|
return g_memdup2 (src, n);
|
||||||
if (!fu_memcpy_safe (dst, n, 0x0, /* dst */
|
#else
|
||||||
src, n, 0x0, /* src */
|
return g_memdup (src, (guint) n);
|
||||||
n, error))
|
#endif
|
||||||
return NULL;
|
|
||||||
return g_steal_pointer (&dst);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user