in first patch, when copying existing env, instead of
```plaintext size = p - cur_env + 1024; env = malloc( size * sizeof(*env) ); ok( env != NULL, "malloc returned NULL\n" ); for (p = cur_env, q = env; *p; p += wcslen( p ) + 1) { wcscpy(q, p); q += wcslen( q ) + 1; } ```
you could do
```plaintext size = p - cur_env; env = malloc( (size + 1024) * sizeof(*env) ); ok( env != NULL, "malloc returned NULL\n" ); memcpy( env, cur_env, size * sizeof(*env) ); q = env + size; ```
(not modifying myself the serie to avoid double write until you're done)