Skip to content

Commit 1f2d3a1

Browse files
authored
Merge pull request #278 from vneiger/fixing_nonnull_pointers
Fixing nonnull pointers
2 parents f286b94 + b753de6 commit 1f2d3a1

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/neogb/la_ff_32.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2311,7 +2311,8 @@ static void probabilistic_sparse_reduced_echelon_form_ff_32(
23112311

23122312
/* we fill in all known lead terms in pivs */
23132313
hm_t **pivs = (hm_t **)calloc((uint64_t)ncols, sizeof(hm_t *));
2314-
memcpy(pivs, mat->rr, (uint64_t)mat->nru * sizeof(hm_t *));
2314+
if (mat->rr != NULL)
2315+
memcpy(pivs, mat->rr, (uint64_t)mat->nru * sizeof(hm_t *));
23152316
j = nrl;
23162317
for (i = 0; i < mat->nru; ++i) {
23172318
mat->cf_32[j] = bs->cf_32[mat->rr[i][COEFFS]];

src/neogb/order.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ static inline void sort_matrix_rows_decreasing(
121121
const len_t nrows
122122
)
123123
{
124-
qsort(rows, (unsigned long)nrows, sizeof(hm_t *),
125-
&matrix_row_cmp_decreasing);
124+
if (rows != NULL) {
125+
qsort(rows, (unsigned long)nrows, sizeof(hm_t *),
126+
&matrix_row_cmp_decreasing);
127+
}
126128
}
127129

128130
static inline void sort_matrix_rows_increasing(

0 commit comments

Comments
 (0)