diff --git a/opm/core/pressure/msmfem/coarse_sys.c b/opm/core/pressure/msmfem/coarse_sys.c index 3cae75c3..10337e8e 100644 --- a/opm/core/pressure/msmfem/coarse_sys.c +++ b/opm/core/pressure/msmfem/coarse_sys.c @@ -723,6 +723,8 @@ blkdof_fill(struct coarse_topology *ct, nb = ct->nblocks; + assert(nb > 0); + sys->blkdof_pos = malloc((nb + 1) * sizeof *sys->blkdof_pos); if (sys->blkdof_pos != NULL) { @@ -824,6 +826,8 @@ coarse_sys_allocate(struct coarse_topology *ct, if (new != NULL) { nb = ct->nblocks; + assert(nb > 0); + alloc_ok = blkdof_fill(ct, m, new); if (alloc_ok) { diff --git a/opm/core/pressure/msmfem/partition.c b/opm/core/pressure/msmfem/partition.c index a056258f..a2eba629 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) { diff --git a/opm/core/utility/writeVtkData.cpp b/opm/core/utility/writeVtkData.cpp index 262ec35d..07e57172 100644 --- a/opm/core/utility/writeVtkData.cpp +++ b/opm/core/utility/writeVtkData.cpp @@ -44,7 +44,7 @@ namespace Opm int num_cells = dims[0]*dims[1]*dims[2]; ASSERT(dimension == 2 || dimension == 3); - ASSERT(num_cells = dims[0]*dims[1]* (dimension == 2 ? 1 : dims[2])); + ASSERT(num_cells == dims[0]*dims[1]* (dimension == 2 ? 1 : dims[2])); os << "# vtk DataFile Version 2.0\n"; os << "Structured Grid\n \n";