summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAlexey Izbyshev <izbyshev@ispras.ru>2018-08-24 15:53:16 (GMT)
committerBenjamin Peterson <benjamin@python.org>2018-08-24 15:53:16 (GMT)
commit498845368ff0f6238750ab1d443e7cf4ec98ccd2 (patch)
tree3c200a764e21c686419865ccadadc55d602d33df /Modules
parent91cb298f811961277fd4cc4a32211899d48bedcb (diff)
downloadcpython-498845368ff0f6238750ab1d443e7cf4ec98ccd2.zip
cpython-498845368ff0f6238750ab1d443e7cf4ec98ccd2.tar.gz
cpython-498845368ff0f6238750ab1d443e7cf4ec98ccd2.tar.bz2
closes bpo-34471: _datetime: Add missing NULL check to tzinfo_from_isoformat_results. (GH-8869)
Reported by Svace static analyzer.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_datetimemodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 2522b65..3ba700b 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -1290,8 +1290,11 @@ tzinfo_from_isoformat_results(int rv, int tzoffset, int tz_useconds) {
}
PyObject *delta = new_delta(0, tzoffset, tz_useconds, 1);
+ if (delta == NULL) {
+ return NULL;
+ }
tzinfo = new_timezone(delta, NULL);
- Py_XDECREF(delta);
+ Py_DECREF(delta);
} else {
tzinfo = Py_None;
Py_INCREF(Py_None);