closes bpo-34471: _datetime: Add missing NULL check to tzinfo_from_isoformat_results. (GH-8869)

Reported by Svace static analyzer.
(cherry picked from commit 498845368f)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
This commit is contained in:
Miss Islington (bot) 2018-08-24 12:13:57 -04:00 committed by GitHub
parent 3e6020c4dd
commit c7f5435201
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1290,8 +1290,11 @@ tzinfo_from_isoformat_results(int rv, int tzoffset, int tz_useconds) {
} }
PyObject *delta = new_delta(0, tzoffset, tz_useconds, 1); PyObject *delta = new_delta(0, tzoffset, tz_useconds, 1);
if (delta == NULL) {
return NULL;
}
tzinfo = new_timezone(delta, NULL); tzinfo = new_timezone(delta, NULL);
Py_XDECREF(delta); Py_DECREF(delta);
} else { } else {
tzinfo = Py_None; tzinfo = Py_None;
Py_INCREF(Py_None); Py_INCREF(Py_None);