Avoid passing NULL as memcpy source (undefined behavior)