Skip to content

Commit

Permalink
leak - fix leaks in fluids ex
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylt committed Aug 28, 2024
1 parent d06a2c1 commit 7de238d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
18 changes: 2 additions & 16 deletions examples/fluids/navierstokes.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,22 +328,8 @@ int main(int argc, char **argv) {

PetscCall(PetscFree(app_ctx->amat_type));
PetscCall(PetscFree(app_ctx->wall_forces.walls));
{
const char *filename = NULL;
PetscBool is_stdout = PETSC_FALSE;

if (app_ctx->wall_forces.viewer) {
PetscCall(PetscViewerFileGetName(app_ctx->wall_forces.viewer, &filename));
if (filename) PetscCall(PetscStrncmp(filename, "stdout", 7, &is_stdout));
if (!is_stdout) PetscCall(PetscViewerDestroy(&app_ctx->wall_forces.viewer));
}

if (app_ctx->turb_spanstats_viewer) {
PetscCall(PetscViewerFileGetName(app_ctx->turb_spanstats_viewer, &filename));
if (filename) PetscCall(PetscStrncmp(filename, "stdout", 7, &is_stdout));
if (!is_stdout) PetscCall(PetscViewerDestroy(&app_ctx->turb_spanstats_viewer));
}
}
PetscCall(PetscViewerDestroy(&app_ctx->wall_forces.viewer));
PetscCall(PetscViewerDestroy(&app_ctx->turb_spanstats_viewer));

// -- Structs
for (PetscInt i = 0; i < problem->num_bc_defs; i++) {
Expand Down
1 change: 1 addition & 0 deletions examples/fluids/problems/advection.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ PetscErrorCode CreateKSPMassOperator_AdvectionStabilized(User user, CeedOperator
PetscCallCeed(ceed, CeedOperatorSetField(*op_mass, "v", elem_restr_q, basis_q, CEED_VECTOR_ACTIVE));
PetscCallCeed(ceed, CeedOperatorSetField(*op_mass, "Grad_v", elem_restr_q, basis_q, CEED_VECTOR_ACTIVE));

PetscCallCeed(ceed, CeedQFunctionContextDestroy(&qf_ctx));
PetscCallCeed(ceed, CeedQFunctionDestroy(&qf_mass));
PetscFunctionReturn(PETSC_SUCCESS);
}
Expand Down

0 comments on commit 7de238d

Please sign in to comment.