Skip to content

Commit

Permalink
Fix save dir string freeing order
Browse files Browse the repository at this point in the history
  • Loading branch information
sergystepanov committed Aug 27, 2024
1 parent 7da993a commit b9d35fa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/worker/caged/libretro/nanoarch/nanoarch.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,14 @@ func (n *Nanoarch) Close() { n.Stopped.Store(true); n.
func (n *Nanoarch) SetLogger(log *logger.Logger) { n.log = log }
func (n *Nanoarch) SetVideoDebounce(t time.Duration) { n.limiter = NewLimit(t) }
func (n *Nanoarch) SetSaveDirSuffix(sx string) {
dir := C.GoString(n.cSaveDirectory) + "/" + sx
err := os.CheckCreateDir(dir)
if err != nil {
n.log.Error().Msgf("couldn't create %v, %v", dir, err)
}
if n.cSaveDirectory != nil {
C.free(unsafe.Pointer(n.cSaveDirectory))
}
dir := C.GoString(n.cSaveDirectory) + "/" + sx
_ = os.CheckCreateDir(dir)
n.cSaveDirectory = C.CString(dir)
}
func (n *Nanoarch) DeleteSaveDir() error {
Expand Down

0 comments on commit b9d35fa

Please sign in to comment.