This fixes the following coverity issues: 163 162 161

Basically the function wasn't freeing memory it used before
returning.

Kent
This commit is contained in:
Kent Mein 2009-12-22 22:03:57 +00:00
parent 8cce609a04
commit c7a471c8c6

@ -283,8 +283,12 @@ sgstrf (superlu_options_t *options, SuperMatrix *A,
* -------------------------------------- */ * -------------------------------------- */
/* Determine the union of the row structure of the snode */ /* Determine the union of the row structure of the snode */
if ( (*info = ssnode_dfs(jcol, kcol, asub, xa_begin, xa_end, 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; return;
}
nextu = xusub[jcol]; nextu = xusub[jcol];
nextlu = xlusup[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); new_next = nextlu + (xlsub[fsupc+1]-xlsub[fsupc])*(kcol-jcol+1);
nzlumax = Glu.nzlumax; nzlumax = Glu.nzlumax;
while ( new_next > nzlumax ) { while ( new_next > nzlumax ) {
if ( (*info = sLUMemXpand(jcol, nextlu, LUSUP, &nzlumax, &Glu)) ) if ( (*info = sLUMemXpand(jcol, nextlu, LUSUP, &nzlumax, &Glu)) ) {
return; if ( iperm_r_allocated ) SUPERLU_FREE (iperm_r);
SUPERLU_FREE (iperm_c);
SUPERLU_FREE (relax_end);
return;
}
} }
for (icol = jcol; icol<= kcol; icol++) { 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], if ((*info = scolumn_dfs(m, jj, perm_r, &nseg, &panel_lsub[k],
segrep, &repfnz[k], xprune, marker, 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 */ /* Numeric updates */
if ((*info = scolumn_bmod(jj, (nseg - nseg1), &dense[k], if ((*info = scolumn_bmod(jj, (nseg - nseg1), &dense[k],
tempv, &segrep[nseg1], &repfnz[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[*] */ /* Copy the U-segments to ucol[*] */
if ((*info = scopy_to_ucol(jj, nseg, segrep, &repfnz[k], if ((*info = scopy_to_ucol(jj, nseg, segrep, &repfnz[k],
perm_r, &dense[k], &Glu)) != 0) perm_r, &dense[k], &Glu)) != 0) {
return; 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, if ( (*info = spivotL(jj, diag_pivot_thresh, &usepr, perm_r,
iperm_r, iperm_c, &pivrow, &Glu, stat)) ) 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); if ( iperm_r_allocated ) SUPERLU_FREE (iperm_r);
SUPERLU_FREE (iperm_c); SUPERLU_FREE (iperm_c);
SUPERLU_FREE (relax_end); SUPERLU_FREE (relax_end);
} }