Commits

Miki Tebeka committed 88f7d1f

fix memleak

  • Participants
  • Parent commits 680b226

Comments (0)

Files changed (2)

+2013-04-05 version 0.1.3
+    * Fix possible memory leak
+
 2012-12-06 version 0.1.2
     * Free memory
 
 import "C"
 
 const (
-	Version = "0.1.2"
+	Version = "0.1.3"
 )
 
 // Stemmer structure
 
 // New creates a new stemmer for lang
 func New(lang string) (*Stemmer, error) {
+	clang := C.CString(lang)
+	defer C.free(unsafe.Pointer(clang))
+
 	stmr := &Stemmer{
 		lang,
-		C.sb_stemmer_new(C.CString(lang), nil),
+		C.sb_stemmer_new(clang, nil),
 	}
 
 	if stmr.stmr == nil {