Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Mein <mein@cs.umn.edu>2009-12-23 01:03:57 +0300
committerKent Mein <mein@cs.umn.edu>2009-12-23 01:03:57 +0300
commitc7a471c8c6ed85796f097019d28081f00c2b539a (patch)
treeae6d2d69782e5e49b32aa9cd0b76751139e082f9 /intern/opennl/superlu
parent8cce609a04518fddc79a8e999884501d80e7d65d (diff)
This fixes the following coverity issues: 163 162 161
Basically the function wasn't freeing memory it used before returning. Kent
Diffstat (limited to 'intern/opennl/superlu')
-rw-r--r--intern/opennl/superlu/sgstrf.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/intern/opennl/superlu/sgstrf.c b/intern/opennl/superlu/sgstrf.c
index 42f8dc9d0ee..e48cc33b00b 100644
--- a/intern/opennl/superlu/sgstrf.c
+++ b/intern/opennl/superlu/sgstrf.c
@@ -283,8 +283,12 @@ sgstrf (superlu_options_t *options, SuperMatrix *A,
* -------------------------------------- */
/* 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 @@ sgstrf (superlu_options_t *options, SuperMatrix *A,
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 @@ sgstrf (superlu_options_t *options, SuperMatrix *A,
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 @@ sgstrf (superlu_options_t *options, SuperMatrix *A,
if ( iperm_r_allocated ) SUPERLU_FREE (iperm_r);
SUPERLU_FREE (iperm_c);
SUPERLU_FREE (relax_end);
-
}