Commit 2fd9e2b
fix: Prevent node from leaking during C binding CloseNode (#5221)
## Relevant issue(s)
Resolves #5206
## Description
It was the case that the C bindings' `CloseNode` function would leak the
node if the `node.Close` call, for some reason, failed. This was because
this failure path leads to the error being returned, and the CGO handle
not being deleted. This PR fixes that by moving the delete above the
`node.Close` call, and having it deferred.
## Tasks
- [x] I made sure the code is well commented, particularly
hard-to-understand areas.
- [x] I made sure the repository-held documentation is changed
accordingly.
- [x] I made sure the pull request title adheres to the conventional
commit style (the subset used in the project can be found in
[tools/configs/chglog/config.yml](tools/configs/chglog/config.yml)).
- [x] I made sure to discuss its limitations such as threats to
validity, vulnerability to mistake and misuse, robustness to
invalidation of assumptions, resource requirements, ...
## How has this been tested?
Specify the platform(s) on which this was tested:
- WSL
Co-authored-by: OvOhao <123258594+OvOhao@users.noreply.github.com>1 parent 53f0e76 commit 2fd9e2b
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
35 | 35 | | |
36 | 36 | | |
0 commit comments