Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
711552bb
Commit
711552bb
authored
Sep 23, 2008
by
Skip Montanaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for issue 3666 - atexit.register with bad inputs segfaults on exit.
Reviewed by Christian Heimes.
parent
9bc9351c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
Modules/atexitmodule.c
Modules/atexitmodule.c
+7
-6
No files found.
Modules/atexitmodule.c
View file @
711552bb
...
...
@@ -10,6 +10,8 @@
/* Forward declaration (for atexit_cleanup) */
static
PyObject
*
atexit_clear
(
PyObject
*
);
/* Forward declaration (for atexit_callfuncs) */
static
void
atexit_cleanup
(
void
);
/* ===================================================================== */
/* Callback machinery. */
...
...
@@ -26,7 +28,7 @@ static int callback_len = 32;
/* Installed into pythonrun.c's atexit mechanism */
void
static
void
atexit_callfuncs
(
void
)
{
PyObject
*
exc_type
=
NULL
,
*
exc_value
,
*
exc_tb
,
*
r
;
...
...
@@ -60,11 +62,13 @@ atexit_callfuncs(void)
}
}
atexit_cleanup
();
if
(
exc_type
)
PyErr_Restore
(
exc_type
,
exc_value
,
exc_tb
);
}
void
static
void
atexit_delete_cb
(
int
i
)
{
atexit_callback
*
cb
=
atexit_callbacks
[
i
];
...
...
@@ -75,7 +79,7 @@ atexit_delete_cb(int i)
PyMem_Free
(
cb
);
}
void
static
void
atexit_cleanup
(
void
)
{
PyObject
*
r
=
atexit_clear
(
NULL
);
...
...
@@ -260,8 +264,5 @@ PyInit_atexit(void)
return
NULL
;
_Py_PyAtExit
(
atexit_callfuncs
);
/* Register a callback that will free
atexit_callbacks, otherwise valgrind will report memory leaks. */
Py_AtExit
(
atexit_cleanup
);
return
m
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment