fix memory leak and null pointer dereference

This commit is contained in:
Guido van Rossum 1995-01-10 15:23:19 +00:00
parent 946805d418
commit c206c766dd
2 changed files with 6 additions and 2 deletions

View file

@ -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);