summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-01-10 15:23:19 (GMT)
committerGuido van Rossum <guido@python.org>1995-01-10 15:23:19 (GMT)
commitc206c766dd743c635397d5e6be9adfdfc8fb921c (patch)
tree903d3367d8e1411206d5c337e022afe80b10b1f9 /Objects/longobject.c
parent946805d418ebaf0ae8fa790cd45aa69267a862f8 (diff)
downloadcpython-c206c766dd743c635397d5e6be9adfdfc8fb921c.zip
cpython-c206c766dd743c635397d5e6be9adfdfc8fb921c.tar.gz
cpython-c206c766dd743c635397d5e6be9adfdfc8fb921c.tar.bz2
fix memory leak and null pointer dereference
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 1829c3d..ef3f332 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -552,7 +552,9 @@ x_divrem(v1, w1, prem)
}
} /* for j, k */
- if (a != NULL) {
+ if (a == NULL)
+ *prem = NULL;
+ else {
a = long_normalize(a);
*prem = divrem1(v, d, &d);
/* d receives the (unused) remainder */
@@ -1001,7 +1003,7 @@ long_pow(a, b, c)
break;
}
}
- if (a == NULL)
+ if (a == NULL || z == NULL)
break;
}
XDECREF(a);