Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash when trying to use gst.RegisterAPIType #52

Open
Philippe-Torrelli-Ale opened this issue Oct 24, 2022 · 1 comment
Open

crash when trying to use gst.RegisterAPIType #52

Philippe-Torrelli-Ale opened this issue Oct 24, 2022 · 1 comment

Comments

@Philippe-Torrelli-Ale
Copy link

Philippe-Torrelli-Ale commented Oct 24, 2022

Hello, i'm trying to add custom meta data into a buffer and have a problem calling RegisterAPIType .

When I do something like
t := gst.RegisterAPIType("NewObjectType", []string{"sometag"} )
the calling program crashes (no stack).

I think gcharStrings has a few major problems

func gcharStrings(strs []string) **C.gchar {
	gcharSlc := make([]*C.gchar, len(strs)) // <- shouldn't it be alloced by the c allocator ? also, it won't be nil terminated
	for _, s := range strs {
		cStr := C.CString(s)
		defer C.free(unsafe.Pointer(cStr)) // <- this will cause the pointed array of char to be freed before we even use the array
		gcharSlc = append(gcharSlc, cStr)
	}
	return &gcharSlc[0]
}

this gcharStrings() function is also called by FilterProtectionSystemByDecryptors() and SelectProtectionSystem()
I am also confused by the fact that the caller calls C.free on the returned object which is &gcharSlc[0]..

@RSWilli
Copy link

RSWilli commented Aug 24, 2023

@Philippe-Torrelli-Ale move this issue to https://github.com/go-gst/go-gst (where future development of the bindings will take place) if you think it is necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants