#17090: Add missing fmpz_init() statements after #16803
-------------------------------------+-------------------------------------
Reporter: jdemeyer | Owner:
Type: defect | Status: new
Priority: blocker | Milestone: sage-6.4
Component: linear algebra | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vbraun/add_missing_fmpz_init | df1045910e8324a19b7efb748d884327be4567cc
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Description changed by jdemeyer:
Old description:
> The code from #16803 is missing `fmpz_init()`/`fmpz_clear()` in several
> places. This can cause random segfaults, as witnessed for example in
> #16938.
New description:
The code from #16803 is missing `fmpz_init()`/`fmpz_clear()` in `_lmul_`
(and perhaps other places too). This can cause random segfaults and memory
leaks, as witnessed for example in #16938.
The code in question:
{{{
cpdef ModuleElement _lmul_(self, RingElement right):
"""
EXAMPLES::
sage: a = matrix(QQ,2,range(6))
sage: (3/4) * a
[ 0 3/4 3/2]
[ 9/4 3 15/4]
"""
cdef Py_ssize_t i
cdef Integer _x
cdef fmpz_t z
_x = Integer(right)
cdef Matrix_integer_dense M
M = self._new_uninitialized_matrix(self._nrows,self._ncols)
sig_on()
fmpz_set_mpz(z,_x.value)
fmpz_mat_scalar_mul_fmpz(M._matrix,self._matrix,z)
sig_off()
M._initialized = True
return M
}}}
--
--
Ticket URL: <http://trac.sagemath.org/ticket/17090#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.