Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions bindings/pyroot/pythonizations/src/RPyROOTApplication.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ bool PyROOT::RPyROOTApplication::CreateApplication(int ignoreCmdLineOpts)
char **argv = nullptr;

if (ignoreCmdLineOpts) {
argv = new char *[argc];
// Last argv must be null (see https://en.cppreference.com/cpp/language/main_function)
argv = new char *[argc + 1] {};
} else {
// Retrieve sys.argv list from Python
PyObject *argl = PySys_GetObject("argv");
Expand All @@ -57,7 +58,8 @@ bool PyROOT::RPyROOTApplication::CreateApplication(int ignoreCmdLineOpts)
argc = static_cast<int>(size);
}

argv = new char *[argc];
// Last argv must be null (see https://en.cppreference.com/cpp/language/main_function)
argv = new char *[argc + 1] {};

for (int i = 1; i < argc; ++i) {
PyObject *item = PyList_GetItem(argl, i);
Expand Down
Loading