From c206c766dd743c635397d5e6be9adfdfc8fb921c Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 10 Jan 1995 15:23:19 +0000 Subject: fix memory leak and null pointer dereference --- Objects/intobject.c | 2 ++ Objects/longobject.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Objects/intobject.c b/Objects/intobject.c index f020453..ca2961e 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -523,6 +523,8 @@ int_pow(v, w, z) XDECREF(t2); return(NULL); } + DECREF(t1); + DECREF(t2); ix=mod; } return newintobject(ix); 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); -- cgit v0.12