Skip to content

Commit

Permalink
Bugfix: Fix error handler memory leak (#467)
Browse files Browse the repository at this point in the history
Fixes memory leak when multiple error handlers are attached. Fixes #446

---------

Co-authored-by: David Gardner <gardner48@llnl.gov>
  • Loading branch information
Steven-Roberts and gardner48 committed Jun 20, 2024
1 parent 15c94cf commit 149d3b3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Added support for Kokkos Kernels v4.

Fixed a bug that caused error messages to be cut off in some cases. Fixes [GitHub Issue #461](https://github.com/LLNL/sundials/issues/461).

Fixed a memory leak when an error handler was added to a `SUNContext`. Fixes [GitHub Issue #466](https://github.com/LLNL/sundials/issues/466).

## Changes to SUNDIALS in release v7.0.0

### Major Feature
Expand Down
3 changes: 3 additions & 0 deletions doc/shared/RecentChanges.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ produced from evolving the inner stepper.
Added support for Kokkos Kernels v4.

Fixed a bug that caused error messages to be cut off in some cases. Fixes `GitHub Issue #461 <https://github.com/LLNL/sundials/issues/461>`_.

Fixed a memory leak when an error handler was added to a :c:type:`SUNContext`. Fixes `GitHub Issue #466 <https://github.com/LLNL/sundials/issues/466>`_.

2 changes: 1 addition & 1 deletion src/sundials/sundials_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ SUNErrCode SUNContext_Free(SUNContext* sunctx)
SUNLogger_Destroy(&(*sunctx)->logger);
}

SUNErrHandler_Destroy(&(*sunctx)->err_handler);
SUNContext_ClearErrHandlers(*sunctx);

free(*sunctx);
*sunctx = NULL;
Expand Down

0 comments on commit 149d3b3

Please sign in to comment.