diff --git a/opm/core/pressure/msmfem/partition.c b/opm/core/pressure/msmfem/partition.c index a056258f4..a2eba6298 100644 --- a/opm/core/pressure/msmfem/partition.c +++ b/opm/core/pressure/msmfem/partition.c @@ -138,6 +138,7 @@ partition_compress(int n, int *p) int ret, i, max, *compr; max = -1; + assert(n > 0); for (i = 0; i < n; i++) { assert (0 <= p[i]); /* Only non-neg partitions (for now?). */ max = MAX(max, p[i]); @@ -313,6 +314,9 @@ partition_create_c2c(int nc, int nneigh, const int *neigh, { int i, ret, c1, c2; + assert(nc > 0); + assert(nneigh > 0); + *pc2c = malloc((nc + 1) * sizeof **pc2c); if (*pc2c != NULL) {