Bug 1060115 - Avoid using malloc/free in b2g.exe on b2g desktop so that we can make it work on XPSP2 with MSVC2013; r=dmajor

This commit is contained in:
Ehsan Akhgari 2014-09-04 23:21:24 -04:00
parent 9fcca9b22a
commit d63d4121d6

View File

@ -283,15 +283,17 @@ int main(int argc, _CONST char* argv[])
*/
_argv = new char *[argc + 1];
for (int i = 0; i < argc; i++) {
_argv[i] = strdup(argv[i]);
size_t len = strlen(argv[i]) + 1;
_argv[i] = new char[len];
MOZ_ASSERT(_argv[i] != nullptr);
memcpy(_argv[i], argv[i], len);
}
_argv[argc] = nullptr;
result = do_main(argc, _argv);
for (int i = 0; i < argc; i++) {
free(_argv[i]);
delete[] _argv[i];
}
delete[] _argv;
}