Windows: make process arguments buffer computation better

This commit is contained in:
Bert Belder 2011-08-03 02:09:37 +02:00
parent ec143961d1
commit 642d97ced8

View File

@ -423,13 +423,9 @@ static wchar_t* make_program_args(char** args) {
arg_count++;
}
/* Adjust for potential quotes. */
size *= 2;
/* Arguments are separated with a space. */
if (arg_count > 0) {
size += arg_count - 1;
}
/* Adjust for potential quotes. Also assume the worst-case scenario
/* that every character needs escaping, so we need twice as much space. */
size = size * 2 + arg_count * 2;
dst = (wchar_t*)malloc(size);
if (!dst) {