Skip to content

Commit

Permalink
fix(consensus): free allocated CStrings (#6054)
Browse files Browse the repository at this point in the history
  • Loading branch information
thechampagne authored Sep 26, 2023
1 parent 7d7918d commit 195d376
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions jina/serve/consensus/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ func add_voter(self *C.PyObject, args *C.PyObject) *C.PyObject {
err := AddVoter(C.GoString(target), C.GoString(raftId), C.GoString(voterAddress))
if err != nil {
logger.Error("Error received calling AddVoter", "error", err)
C.raise_exception(C.CString("Error from AddVoter"))
cerr := C.CString("Error from AddVoter")
defer C.free(unsafe.Pointer(cerr))
C.raise_exception(cerr)
return nil
}
}
Expand Down Expand Up @@ -455,6 +457,8 @@ func get_configuration(self *C.PyObject, args *C.PyObject) *C.PyObject {
return pyStr

}
C.raise_exception(C.CString("Error from get_configuration, wrong parameters passed"))
cerr := C.CString("Error from get_configuration, wrong parameters passed")
defer C.free(unsafe.Pointer(cerr))
C.raise_exception(cerr)
return nil
}

0 comments on commit 195d376

Please sign in to comment.