NULL is valid when size is 0, but memcpy uses nonnull attributes, so let's not poke the bear
avoids pointless allocs and memcpy