Fix dangling pointers in CefScopedArgArray (fixes issue #2704).
This commit is contained in:
parent
3f1ebebde5
commit
17ec55a3b3
|
@ -97,8 +97,9 @@ class CefScopedArgArray {
|
||||||
CefScopedArgArray(int argc, char* argv[]) {
|
CefScopedArgArray(int argc, char* argv[]) {
|
||||||
// argv should have (argc + 1) elements, the last one always being NULL.
|
// argv should have (argc + 1) elements, the last one always being NULL.
|
||||||
array_ = new char*[argc + 1];
|
array_ = new char*[argc + 1];
|
||||||
|
values_.resize(argc);
|
||||||
for (int i = 0; i < argc; ++i) {
|
for (int i = 0; i < argc; ++i) {
|
||||||
values_.push_back(argv[i]);
|
values_[i] = argv[i];
|
||||||
array_[i] = const_cast<char*>(values_[i].c_str());
|
array_[i] = const_cast<char*>(values_[i].c_str());
|
||||||
}
|
}
|
||||||
array_[argc] = NULL;
|
array_[argc] = NULL;
|
||||||
|
|
Loading…
Reference in New Issue