Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit50c1471

Browse files
authored
gh-144986: Fix memory leak in atexit.register() (#144987)
1 parent87c4fc1 commit50c1471

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix a memory leak in:func:`atexit.register`.
2+
Patch by Shamil Abdulaev.

‎Modules/atexitmodule.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,17 @@ atexit_register(PyObject *module, PyObject *args, PyObject *kwargs)
185185
returnNULL;
186186
}
187187
PyObject*func_args=PyTuple_GetSlice(args,1,PyTuple_GET_SIZE(args));
188+
if (func_args==NULL) {
189+
returnNULL;
190+
}
188191
PyObject*func_kwargs=kwargs;
189192

190193
if (func_kwargs==NULL)
191194
{
192195
func_kwargs=Py_None;
193196
}
194197
PyObject*callback=PyTuple_Pack(3,func,func_args,func_kwargs);
198+
Py_DECREF(func_args);
195199
if (callback==NULL)
196200
{
197201
returnNULL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp