More bugs found thanks to klockwork

mallocn.c  check malloced memory before using it.
ssp_blas2.c free memory that wasn't but should have been.

Kent
This commit is contained in:
Kent Mein 2006-10-27 15:00:31 +00:00
parent 45c1f23f19
commit 4657db2a38
2 changed files with 7 additions and 1 deletions

@ -210,6 +210,9 @@ void *MEM_dupallocN(void *vmemh)
newp= MEM_mapallocN(memh->len, "dupli_mapalloc");
else
newp= MEM_mallocN(memh->len, "dupli_alloc");
if (newp == NULL) return NULL;
memcpy(newp, vmemh, memh->len);
}

@ -119,7 +119,10 @@ sp_strsv(char *uplo, char *trans, char *diag, SuperMatrix *L,
if ( lsame_(uplo, "L") ) {
/* Form x := inv(L)*x */
if ( L->nrow == 0 ) return 0; /* Quick return */
if ( L->nrow == 0 ) {
SUPERLU_FREE(work);
return 0; /* Quick return */
}
for (k = 0; k <= Lstore->nsuper; k++) {
fsupc = L_FST_SUPC(k);