[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25530] trunk/blender/intern/opennl/ superlu/sgstrf.c: This fixes the following coverity issues: 163 162 161
Kent Mein
mein at cs.umn.edu
Tue Dec 22 23:03:57 CET 2009
Revision: 25530
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25530
Author: sirdude
Date: 2009-12-22 23:03:57 +0100 (Tue, 22 Dec 2009)
Log Message:
-----------
This fixes the following coverity issues: 163 162 161
Basically the function wasn't freeing memory it used before
returning.
Kent
Modified Paths:
--------------
trunk/blender/intern/opennl/superlu/sgstrf.c
Modified: trunk/blender/intern/opennl/superlu/sgstrf.c
===================================================================
--- trunk/blender/intern/opennl/superlu/sgstrf.c 2009-12-22 19:56:12 UTC (rev 25529)
+++ trunk/blender/intern/opennl/superlu/sgstrf.c 2009-12-22 22:03:57 UTC (rev 25530)
@@ -283,8 +283,12 @@
* -------------------------------------- */
/* Determine the union of the row structure of the snode */
if ( (*info = ssnode_dfs(jcol, kcol, asub, xa_begin, xa_end,
- xprune, marker, &Glu)) != 0 )
+ xprune, marker, &Glu)) != 0 ) {
+ if ( iperm_r_allocated ) SUPERLU_FREE (iperm_r);
+ SUPERLU_FREE (iperm_c);
+ SUPERLU_FREE (relax_end);
return;
+ }
nextu = xusub[jcol];
nextlu = xlusup[jcol];
@@ -293,8 +297,12 @@
new_next = nextlu + (xlsub[fsupc+1]-xlsub[fsupc])*(kcol-jcol+1);
nzlumax = Glu.nzlumax;
while ( new_next > nzlumax ) {
- if ( (*info = sLUMemXpand(jcol, nextlu, LUSUP, &nzlumax, &Glu)) )
- return;
+ if ( (*info = sLUMemXpand(jcol, nextlu, LUSUP, &nzlumax, &Glu)) ) {
+ if ( iperm_r_allocated ) SUPERLU_FREE (iperm_r);
+ SUPERLU_FREE (iperm_c);
+ SUPERLU_FREE (relax_end);
+ return;
+ }
}
for (icol = jcol; icol<= kcol; icol++) {
@@ -350,17 +358,31 @@
if ((*info = scolumn_dfs(m, jj, perm_r, &nseg, &panel_lsub[k],
segrep, &repfnz[k], xprune, marker,
- parent, xplore, &Glu)) != 0) return;
+ parent, xplore, &Glu)) != 0) {
+ if ( iperm_r_allocated ) SUPERLU_FREE (iperm_r);
+ SUPERLU_FREE (iperm_c);
+ SUPERLU_FREE (relax_end);
+ return;
+ }
/* Numeric updates */
if ((*info = scolumn_bmod(jj, (nseg - nseg1), &dense[k],
tempv, &segrep[nseg1], &repfnz[k],
- jcol, &Glu, stat)) != 0) return;
+ jcol, &Glu, stat)) != 0) {
+ if ( iperm_r_allocated ) SUPERLU_FREE (iperm_r);
+ SUPERLU_FREE (iperm_c);
+ SUPERLU_FREE (relax_end);
+ return;
+ }
/* Copy the U-segments to ucol[*] */
if ((*info = scopy_to_ucol(jj, nseg, segrep, &repfnz[k],
- perm_r, &dense[k], &Glu)) != 0)
- return;
+ perm_r, &dense[k], &Glu)) != 0) {
+ if ( iperm_r_allocated ) SUPERLU_FREE (iperm_r);
+ SUPERLU_FREE (iperm_c);
+ SUPERLU_FREE (relax_end);
+ return;
+ }
if ( (*info = spivotL(jj, diag_pivot_thresh, &usepr, perm_r,
iperm_r, iperm_c, &pivrow, &Glu, stat)) )
@@ -429,5 +451,4 @@
if ( iperm_r_allocated ) SUPERLU_FREE (iperm_r);
SUPERLU_FREE (iperm_c);
SUPERLU_FREE (relax_end);
-
}
More information about the Bf-blender-cvs
mailing list