#12858: Bug in sympow
-----------------------+----------------------------------------------------
   Reporter:  stephen  |             Owner:  rlm     
       Type:  defect   |            Status:  new     
   Priority:  major    |         Milestone:  sage-5.1
  Component:  memleak  |          Keywords:  sympow  
Work issues:           |   Report Upstream:  N/A     
  Reviewers:           |           Authors:          
  Merged in:           |      Dependencies:          
   Stopgaps:           |  
-----------------------+----------------------------------------------------
 In util.c there is a function free_data, which frees TACKS[0].  TACKS[0]
 is meant to be allocated in disk.c, but there are circumstances when
 TACKS[0] is not allocated.

 The following patch seems to fix it.  Notice that it makes use of the fact
 that free(NULL) should do nothing in the C programming language.

 {{{
 --- sympow-1.018.1.p11/src/disk.c-orig  2012-04-19 02:33:51.000000000
 +0000
 +++ sympow-1.018.1.p11/src/disk.c       2012-04-19 02:34:22.000000000
 +0000
 @@ -39,7 +39,7 @@
   else if (((sp&3)==0) && CM_CASE) {if (2*ep==sp) S[3]='l'; else
 S[3]='h';}
   else {if (2*ep==sp) S[3]='L'; else S[3]='H';}
   if (HECKE && dv) {TACKS[which]=malloc(dv*sizeof(QD)); TACKON[which]=dv;}
 - else if (dv<=sp/2) TACKON[which]=0;
 + else if (dv<=sp/2) {TACKS[which]=NULL; TACKON[which]=0;}
   else {TACKS[which]=malloc((dv-sp/2)*sizeof(QD)); TACKON[which]=dv-sp/2;}
   S[4]=0; F=fopen("datafiles/param_data","r"); strcpy(U,S);
   if (ANAL_RANK) {if (dv>0) U[0]='A'; else U[0]='m';}
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12858>
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 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.

Reply via email to