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.
diff --git a/Modules/main.c b/Modules/main.c
index 5abf2a6..5140c4f 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -216,6 +216,7 @@
if (command) {
sts = PyRun_SimpleString(command) != 0;
+ free(command);
}
else {
if (filename == NULL && stdin_is_interactive) {
@@ -240,8 +241,8 @@
(filename != NULL || command != NULL))
sts = PyRun_AnyFile(stdin, "<stdin>") != 0;
- Py_Exit(sts);
- return 0; /* Make gcc -Wall happy */
+ Py_Cleanup();
+ return sts;
}