diff --git a/puremd_rc_1003/sPuReMD/allocate.c b/puremd_rc_1003/sPuReMD/allocate.c index bb3fccf96d7035c7ca67bc8de76606b58604e241..c9e8e1d9fb7bec3672b328455d9054a0e39b781d 100644 --- a/puremd_rc_1003/sPuReMD/allocate.c +++ b/puremd_rc_1003/sPuReMD/allocate.c @@ -43,16 +43,27 @@ int Allocate_Matrix( sparse_matrix **pH, int n, int m ) sparse_matrix *H; if( (*pH = (sparse_matrix*) malloc(sizeof(sparse_matrix))) == NULL ) + { return 0; + } H = *pH; H->n = n; H->m = m; - if( (H->start = (int*) malloc(sizeof(int) * n+1)) == NULL ) + if( (H->start = (int*) malloc(sizeof(int) * (n+1))) == NULL ) + { return 0; + } if( (H->entries = - (sparse_matrix_entry*) malloc(sizeof(sparse_matrix_entry)*m)) == NULL ) + (sparse_matrix_entry*) malloc(sizeof(sparse_matrix_entry)*m)) == NULL ) + { return 0; + } +// if( ((H->j = (int*) malloc(sizeof(int)*m)) == NULL) || +// ((H->val = (real*) malloc(sizeof(real)*m)) == NULL) ) +// { +// return 0; +// } return 1; }