Repository navigation
Conversation
ryux1
force-pushed
the
fix/free-onnx-model-path
branch
from
September 17, 2026 13:51
ccbd78b to
65e619d
Compare
Author
|
Rebased onto the current Passed:
|
NewOnnx passed a C.CString allocation inline to CreateSession, leaving no pointer available to release on either success or error. Keep the Go-owned C string in a local variable and defer C.free after the C call has finished using it. ONNX-owned session resources remain outside this change.
ryux1
force-pushed
the
fix/free-onnx-model-path
branch
from
October 8, 2026 21:17
65e619d to
9f23433
Compare
Author
|
Apologies for the delayed follow-up. I refreshed the single focused commit onto the current main today; the PR is mergeable, the current hosted scan and CLA checks pass, and the previously documented Go, vet, tagged ONNX, and CLI validations remain the relevant contributor-side evidence. The change is still limited to releasing the Go-owned model-path C string, with ONNX-owned cleanup intentionally out of scope. This is ready for a code-owner review when convenient. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Keep the
C.CStringused for the ONNX model path in a local variable and release it afterCreateSessionreturns. The deferredC.freecovers both the successful and error paths.This intentionally leaves the separately reported ONNX-owned environment, options, and status cleanup out of scope.
Fixes #1444
Testing
Using Go 1.22.3 and ONNX Runtime 1.19.2 with the versions, linker flags, assets, and SHA-256 digest pinned by the repository:
go test ./...go vet ./...go vet -tags onnxruntime ./...go test -v -tags onnxruntime -ldflags="-linkmode=external -extldflags=-L/opt/onnxruntime/lib" ./...go build -tags onnxruntime -ldflags="-linkmode=external -extldflags=-L/opt/onnxruntime/lib" .fromgo/cli