Commit 87ab6ad4 authored by Brett Cannon's avatar Brett Cannon

Prevent a possible NULL de-reference and an unneeded variable assignment.

Found using Clang's static analyzer.
parent e894e93f
...@@ -1520,7 +1520,7 @@ delta_to_microseconds(PyDateTime_Delta *self) ...@@ -1520,7 +1520,7 @@ delta_to_microseconds(PyDateTime_Delta *self)
goto Done; goto Done;
Py_DECREF(x1); Py_DECREF(x1);
Py_DECREF(x2); Py_DECREF(x2);
x1 = x2 = NULL; x2 = NULL;
/* x3 has days+seconds in seconds */ /* x3 has days+seconds in seconds */
x1 = PyNumber_Multiply(x3, us_per_second); /* us */ x1 = PyNumber_Multiply(x3, us_per_second); /* us */
...@@ -3952,7 +3952,7 @@ datetime_strptime(PyObject *cls, PyObject *args) ...@@ -3952,7 +3952,7 @@ datetime_strptime(PyObject *cls, PyObject *args)
else else
good_timetuple = 0; good_timetuple = 0;
/* follow that up with a little dose of microseconds */ /* follow that up with a little dose of microseconds */
if (PyInt_Check(frac)) if (good_timetuple && PyInt_Check(frac))
ia[6] = PyInt_AsLong(frac); ia[6] = PyInt_AsLong(frac);
else else
good_timetuple = 0; good_timetuple = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment