However, there was no error checking that PyFloat_FromDouble returned
a valid pointer. I believe this change is correct as it seemed
to follow other code in the area.
Klocwork # 292.
w_byte(TYPE_COMPLEX, p);
temp = (PyFloatObject*)PyFloat_FromDouble(
PyComplex_RealAsDouble(v));
+ if (!temp) {
+ p->error = 1;
+ return;
+ }
PyFloat_AsReprString(buf, temp);
Py_DECREF(temp);
n = strlen(buf);
w_string(buf, (int)n, p);
temp = (PyFloatObject*)PyFloat_FromDouble(
PyComplex_ImagAsDouble(v));
+ if (!temp) {
+ p->error = 1;
+ return;
+ }
PyFloat_AsReprString(buf, temp);
Py_DECREF(temp);
n = strlen(buf);