Commit e9003889 authored by Guido van Rossum's avatar Guido van Rossum

Free the malloc'ed buffer that holds the command once we're done with it.

Instead of calling Py_Exit(sts), call Py_Cleanup() and return sts.
parent 47960358
...@@ -216,6 +216,7 @@ Py_Main(argc, argv) ...@@ -216,6 +216,7 @@ Py_Main(argc, argv)
if (command) { if (command) {
sts = PyRun_SimpleString(command) != 0; sts = PyRun_SimpleString(command) != 0;
free(command);
} }
else { else {
if (filename == NULL && stdin_is_interactive) { if (filename == NULL && stdin_is_interactive) {
...@@ -240,8 +241,8 @@ Py_Main(argc, argv) ...@@ -240,8 +241,8 @@ Py_Main(argc, argv)
(filename != NULL || command != NULL)) (filename != NULL || command != NULL))
sts = PyRun_AnyFile(stdin, "<stdin>") != 0; sts = PyRun_AnyFile(stdin, "<stdin>") != 0;
Py_Exit(sts); Py_Cleanup();
return 0; /* Make gcc -Wall happy */ return sts;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment