fix: AddPunct panic for Go(#1921)

This commit is contained in:
xcel3011
2025-02-25 18:09:28 +08:00
committed by GitHub
parent 0dcaf3a061
commit b042f5e179

View File

@@ -1483,7 +1483,7 @@ func DeleteOfflinePunc(punc *OfflinePunctuation) {
func (punc *OfflinePunctuation) AddPunct(text string) string {
p := C.SherpaOfflinePunctuationAddPunct(punc.impl, C.CString(text))
defer C.free(unsafe.Pointer(p))
defer C.SherpaOfflinePunctuationFreeText(p)
text_with_punct := C.GoString(p)