#4962: sage/modules/vector_modn_sparse_c.pxi: init_c_vector_modint leaks leak
memory in case of OverflowError
----------------------+-----------------------------------------------------
Reporter: mabshoff | Owner: craigcitro
Type: defect | Status: new
Priority: major | Milestone: sage-3.3
Component: memleak | Keywords:
----------------------+-----------------------------------------------------
Look at:
{{{
cdef int init_c_vector_modint(c_vector_modint* v, int p, Py_ssize_t
degree,
Py_ssize_t num_nonzero) except -1:
"""
Initialize a c_vector_modint.
"""
if (allocate_c_vector_modint(v, num_nonzero) == -1):
raise MemoryError, "Error allocating memory for sparse vector."
if p > 46340:
raise OverflowError, "The prime must be <= 46340."
v.num_nonzero = num_nonzero
v.degree = degree
v.p = p
return 0
}}}
On OverflowError v is leaked. Switching check and allocation will fix the
problem.
Cheers,
Michael
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4962>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---