summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
diff options
context:
space:
mode:
authorHye-Shik Chang <hyeshik@gmail.com>2006-03-07 15:39:21 (GMT)
committerHye-Shik Chang <hyeshik@gmail.com>2006-03-07 15:39:21 (GMT)
commit4af5c8cee4885df70884a58e2e74c48984bbe7c2 (patch)
treef4c33e559962940576f84b61f760a1b27a3b8618 /Objects/longobject.c
parentef1701f7d3a57427c1289bef32227a7aaac7905a (diff)
downloadcpython-4af5c8cee4885df70884a58e2e74c48984bbe7c2.zip
cpython-4af5c8cee4885df70884a58e2e74c48984bbe7c2.tar.gz
cpython-4af5c8cee4885df70884a58e2e74c48984bbe7c2.tar.bz2
SF #1444030: Fix several potential defects found by Coverity.
(reviewed by Neal Norwitz)
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 345d3b4..9032656 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -2809,6 +2809,8 @@ long_bitwise(PyLongObject *a,
if (a->ob_size < 0) {
a = (PyLongObject *) long_invert(a);
+ if (a == NULL)
+ return NULL;
maska = MASK;
}
else {
@@ -2817,6 +2819,10 @@ long_bitwise(PyLongObject *a,
}
if (b->ob_size < 0) {
b = (PyLongObject *) long_invert(b);
+ if (b == NULL) {
+ Py_DECREF(a);
+ return NULL;
+ }
maskb = MASK;
}
else {
@@ -2868,7 +2874,7 @@ long_bitwise(PyLongObject *a,
: (maskb ? size_a : MIN(size_a, size_b)))
: MAX(size_a, size_b);
z = _PyLong_New(size_z);
- if (a == NULL || b == NULL || z == NULL) {
+ if (z == NULL) {
Py_XDECREF(a);
Py_XDECREF(b);
Py_XDECREF(z);