Skip to content

Commit 40b12bb

Browse files
committed
incorrect memory freeing resolved.
1 parent 2a0d834 commit 40b12bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sage/rings/polynomial/multi_polynomial_libsingular.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1169,8 +1169,8 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn
11691169
self._parent = <ParentWithBase>parent
11701170

11711171
def __dealloc__(self):
1172-
# for some mysterious reason, this may be NULL in some cases
1173-
if (<MPolynomialRing_libsingular>self._parent)._ring != NULL:
1172+
# for some mysterious reason, various things may be NULL in some cases
1173+
if self._parent is not <ParentWithBase>None and (<MPolynomialRing_libsingular>self._parent)._ring != NULL and self._poly != NULL:
11741174
p_Delete(&self._poly, (<MPolynomialRing_libsingular>self._parent)._ring)
11751175

11761176
def __call__(self, *x):

0 commit comments

Comments
 (0)