Skip to content

Commit 05f7c50

Browse files
committed
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.
1 parent eb46d67 commit 05f7c50

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Modules/main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ Py_Main(argc, argv)
216216

217217
if (command) {
218218
sts = PyRun_SimpleString(command) != 0;
219+
free(command);
219220
}
220221
else {
221222
if (filename == NULL && stdin_is_interactive) {
@@ -240,8 +241,8 @@ Py_Main(argc, argv)
240241
(filename != NULL || command != NULL))
241242
sts = PyRun_AnyFile(stdin, "<stdin>") != 0;
242243

243-
Py_Exit(sts);
244-
return 0; /* Make gcc -Wall happy */
244+
Py_Cleanup();
245+
return sts;
245246
}
246247

247248

0 commit comments

Comments
 (0)