From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 24 Aug 2018 16:13:57 +0000 (-0400) Subject: closes bpo-34471: _datetime: Add missing NULL check to tzinfo_from_isoformat_results... X-Git-Tag: v3.7.1rc1~149 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c7f543520161b895796a571881da74e805d0b1eb;p=thirdparty%2FPython%2Fcpython.git closes bpo-34471: _datetime: Add missing NULL check to tzinfo_from_isoformat_results. (GH-8869) Reported by Svace static analyzer. (cherry picked from commit 498845368ff0f6238750ab1d443e7cf4ec98ccd2) Co-authored-by: Alexey Izbyshev --- diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 91d6991b2af9..41b95b919394 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);