8000 free memory · peterlee2008/go-python@dc533f6 · GitHub
[go: up one dir, main page]

Skip to content

Commit dc533f6

Browse files
eliothedemansbinet
authored andcommitted
free memory
1 parent f43dcc3 commit dc533f6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

otherobjects.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,10 @@ func PyCallIter_New(callable, sentinel *PyObject) *PyObject {
596596
// Return value: New reference.
597597
// Return an empty CodePythonObject that corosponds to the file name, func name and line number in the source file it points to.
598598
func PyCode_NewEmpty(filename string, funcname string, firstlineno int) *PyObject {
599+
c_filename := C.CString(filename)
600+
c_funcname := C.CString(funcname)
601+
defer C.free(unsafe.Pointer(c_filename))
602+
defer C.free(unsafe.Pointer(c_funcname))
599603
return togo((*C.PyObject)(unsafe.Pointer(C.PyCode_NewEmpty(C.CString(filename), C.CString(funcname), C.int(firstlineno)))))
600604
}
601605

0 commit comments

Comments
 (0)
0