summaryrefslogtreecommitdiffstats
path: root/Modules/faulthandler.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-04-08 10:48:15 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-04-08 10:48:15 (GMT)
commitcfa7123ef108452dd402e3cdcec772be28872e2f (patch)
tree679f3380a96b416bb75a8e40e1488a016a7a2045 /Modules/faulthandler.c
parent7ede59d77a9b21c5c021d1b9a4289aba11509fdd (diff)
downloadcpython-cfa7123ef108452dd402e3cdcec772be28872e2f.zip
cpython-cfa7123ef108452dd402e3cdcec772be28872e2f.tar.gz
cpython-cfa7123ef108452dd402e3cdcec772be28872e2f.tar.bz2
faulthandler: fix unregister() if it is called before register()
Fix a crash: don't read from NULL.
Diffstat (limited to 'Modules/faulthandler.c')
-rw-r--r--Modules/faulthandler.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 76cadf3..1132036 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -694,6 +694,9 @@ faulthandler_unregister_py(PyObject *self, PyObject *args)
if (!check_signum(signum))
return NULL;
+ if (user_signals == NULL)
+ Py_RETURN_FALSE;
+
user = &user_signals[signum];
change = faulthandler_unregister(user, signum);
return PyBool_FromLong(change);