Mercurial > cpython-lru_cache-weakref
diff Objects/longobject.c @ 2111:30cbe024df40 legacy-trunk
fix memory leak and null pointer dereference
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 10 Jan 1995 15:23:19 +0000 |
| parents | 866c81068dbd |
| children | 29720c5d9e7e |
line wrap: on
line diff
--- a/Objects/longobject.c Tue Jan 10 10:51:08 1995 +0000 +++ b/Objects/longobject.c Tue Jan 10 15:23:19 1995 +0000 @@ -552,7 +552,9 @@ } } /* 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 @@ break; } } - if (a == NULL) + if (a == NULL || z == NULL) break; } XDECREF(a);
