Skip to content

Commit

Permalink
Fix minor memleak in Go bindings (#241)
Browse files Browse the repository at this point in the history
* Fix minor memleak in Go bindings

* Move fclose back to after nil check

* Move it to correct spot, ugh
  • Loading branch information
jtraglia committed Mar 24, 2023
1 parent 9a93c75 commit c448e9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bindings/go/main.go
Expand Up @@ -91,7 +91,11 @@ func LoadTrustedSetupFile(trustedSetupFile string) CKZGRet {
if loaded {
panic("trusted setup is already loaded")
}
fp := C.fopen(C.CString(trustedSetupFile), C.CString("rb"))
cTrustedSetupFile := C.CString(trustedSetupFile)
defer C.free(unsafe.Pointer(cTrustedSetupFile))
cMode := C.CString("r")
defer C.free(unsafe.Pointer(cMode))
fp := C.fopen(cTrustedSetupFile, cMode)
if fp == nil {
panic("error reading trusted setup")
}
Expand Down

0 comments on commit c448e9b

Please sign in to comment.