-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
I get a segfault when trying to parse a error message from gstreamer.
*** glibc detected *** /usr/local/bin/rtp-receiver: free(): invalid pointer: 0x00fd9040 ***
SIGABRT: abort
PC=0xb6c1acdc
goroutine 43 [syscall]:
runtime.cgocall(0xf7f8, 0x8246cb88)
/usr/lib/go/src/pkg/runtime/cgocall.c:142 +0xdc fp=0x8246cb78 sp=0x8246cb4c
github.com/ziutek/gst._Cfunc_free(0xfd9040)
github.com/ziutek/gst/_obj/_cgo_defun.c:82 +0x34 fp=0x8246cb84 sp=0x8246cb78
github.com/ziutek/gst.(*Message).ParseError(0x10b9c08, 0x96b92bc0, 0x96b2c680, 0x73)
/home/pi/.go/src/github.com/ziutek/gst/message.go:157 +0x188 fp=0x8246cba8 sp=0x8246cb84
main.(*Manager).onMessage(0x96b00540, 0x96b0b7a8, 0x10b9c08)
/home/pi/go/streaming/common-client.go:49 +0xd0 fp=0x8246cc1c sp=0x8246c
[..]
I tried it with different go versions without any change in behavior.
My current workaround is to comment out two lines in the library to not make it free the two pointers:
func (m *Message) ParseError() (err *glib.Error, debug string) {
var d *C.gchar
var e, ret_e *C.GError
C.gst_message_parse_error(m.g(), &e, &d)
// prevent segfaults by not freeing the pointer
//defer C.free(unsafe.Pointer(e))
//defer C.free(unsafe.Pointer(d))
debug = C.GoString((*C.char)(d))
ret_e = new(C.GError)
*ret_e = *e
err = (*glib.Error)(unsafe.Pointer(ret_e))
return
}
I'm not sure, if this is the way to fix it. I guess it creates a memory leak.
Metadata
Metadata
Assignees
Labels
No labels