Skip to content

Commit 27b26bc

Browse files
committed
Fixed apparent access to uninitialized var
No error before: cpychecker is confused but the var was init'd by PyLong_FromString. davidmalcolm/gcc-python-plugin#167
1 parent 1f62b47 commit 27b26bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

psycopg/typecast_datetime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static PyObject *
286286
interval_from_usecs(const char *str)
287287
{
288288
PyObject *us = NULL;
289-
char *pend;
289+
char *pend = NULL;
290290
PyObject *rv = NULL;
291291

292292
Dprintf("interval_from_usecs: %s", str);
@@ -296,7 +296,7 @@ interval_from_usecs(const char *str)
296296
goto exit;
297297
}
298298

299-
if (*pend != '\0') {
299+
if (pend && *pend != '\0') {
300300
/* there are trailing chars, it's not just micros. Barf. */
301301
Dprintf("interval_from_usecs: spurious chars %s", pend);
302302
PyErr_Format(PyExc_ValueError,

0 commit comments

Comments
 (0)