memdup2

fun memdup2(mem: <Error class: unknown class>? = null, byteSize: <Error class: unknown class>): <Error class: unknown class>?

Allocates @byte_size bytes of memory, and copies @byte_size bytes into it from @mem. If @mem is NULL it returns NULL.

This replaces func@GLib.memdup, which was prone to integer overflows when converting the argument from a gsize to a guint.

Return

a pointer to the newly-allocated copy of the memory

Since

2.68

Parameters

mem

the memory to copy

byteSize

the number of bytes to copy