Skip to content

Commit c7f5435

Browse files
miss-islingtonAlexey Izbyshev
andauthored
closes bpo-34471: _datetime: Add missing NULL check to tzinfo_from_isoformat_results. (GH-8869)
Reported by Svace static analyzer. (cherry picked from commit 4988453) Co-authored-by: Alexey Izbyshev <[email protected]>
1 parent 3e6020c commit c7f5435

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Modules/_datetimemodule.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,8 +1290,11 @@ tzinfo_from_isoformat_results(int rv, int tzoffset, int tz_useconds) {
12901290
}
12911291

12921292
PyObject *delta = new_delta(0, tzoffset, tz_useconds, 1);
1293+
if (delta == NULL) {
1294+
return NULL;
1295+
}
12931296
tzinfo = new_timezone(delta, NULL);
1294-
Py_XDECREF(delta);
1297+
Py_DECREF(delta);
12951298
} else {
12961299
tzinfo = Py_None;
12971300
Py_INCREF(Py_None);

0 commit comments

Comments
 (0)