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.
This commit is contained in:
Guido van Rossum 1997-08-02 03:00:42 +00:00
parent eb46d67ce5
commit 05f7c50bfd
1 changed files with 3 additions and 2 deletions

View File

@ -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)
(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;
} }