]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
closes bpo-34471: _datetime: Add missing NULL check to tzinfo_from_isoformat_results...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 24 Aug 2018 16:13:57 +0000 (12:13 -0400)
committerGitHub <noreply@github.com>
Fri, 24 Aug 2018 16:13:57 +0000 (12:13 -0400)
Reported by Svace static analyzer.
(cherry picked from commit 498845368ff0f6238750ab1d443e7cf4ec98ccd2)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
Modules/_datetimemodule.c

index 91d6991b2af99d5e313b7aa059c3c7718f92cc35..41b95b919394e039bb9b01db9d7fd8b559eefc75 100644 (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);
+        if (delta == NULL) {
+            return NULL;
+        }
         tzinfo = new_timezone(delta, NULL);
-        Py_XDECREF(delta);
+        Py_DECREF(delta);
     } else {
         tzinfo = Py_None;
         Py_INCREF(Py_None);