From c92392800adcab215a43e244a779cb5fbe225d9e Mon Sep 17 00:00:00 2001 From: Jeffrey Sorensen Date: Sat, 23 May 2026 13:06:13 -0700 Subject: [PATCH] Resolve ASAN memory leaks. PiperOrigin-RevId: 920253742 --- openfst/extensions/python/pywrapfst.pyx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openfst/extensions/python/pywrapfst.pyx b/openfst/extensions/python/pywrapfst.pyx index 5385675e..e8b82238 100644 --- a/openfst/extensions/python/pywrapfst.pyx +++ b/openfst/extensions/python/pywrapfst.pyx @@ -3176,18 +3176,18 @@ cdef class VectorFst(MutableFst): cdef Fst _init_Fst(FstClass_ptr tfst): - if tfst.Properties(fst.kError, True) == fst.kError: - raise FstOpError("Operation failed") cdef Fst _ofst = Fst.__new__(Fst) _ofst._fst.reset(tfst) + if _ofst._fst.get().Properties(fst.kError, True) == fst.kError: + raise FstOpError("Operation failed") return _ofst cdef MutableFst _init_MutableFst(MutableFstClass_ptr tfst): - if tfst.Properties(fst.kError, True) == fst.kError: - raise FstOpError("Operation failed") cdef MutableFst _ofst = MutableFst.__new__(MutableFst) _ofst._fst.reset(tfst) + if _ofst._fst.get().Properties(fst.kError, True) == fst.kError: + raise FstOpError("Operation failed") # Makes a copy of it as the derived type! Cool. _ofst._mfst = static_pointer_cast[fst.MutableFstClass, fst.FstClass](_ofst._fst)