#14501: Fix memory allocation problems in data_structures_pyx.pxi
---------------------------------+------------------------------------------
Reporter: dcoudert | Owner: joyner
Type: defect | Status: needs_review
Priority: major | Milestone: sage-5.10
Component: group theory | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: David Coudert | Merged in:
Dependencies: | Stopgaps:
---------------------------------+------------------------------------------
Comment (by ncohen):
Your patch adds
{{{
sage_free(int_array)
sage_free(int_ptrs)
}}}
three lines before `SC_dealloc(SC)`. In `SC_dealloc` :
{{{
sage_free(SC.generators) # frees int_ptrs
sage_free(SC.orbit_sizes) # frees int_array
}}}
You also set to NULL the members of a structure that is deallocated two
lines afterwards.
The `and SC.gen_inverses is not NULL` also seems to be unnecessary, for
`SC.gen` and `SC.gen_inverses` are always allocated (and checked)
simultaneously, so that both are not NULL or both are NULL. And
"formally", that is if you believe that one can be NULL while the other is
not (which does not happen) you introduce a memory leak with this
additional leak, for you will only deallocate both vectors if BOTH are
NULL, and do nothing when only one of them is NULL (which again, does not
happen).
Nathann
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14501#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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.