From 3ed00e610f74a74a34ac7d23bba6343cd76620d0 Mon Sep 17 00:00:00 2001 From: belliash Date: Mon, 23 Jul 2018 19:43:04 +0200 Subject: [PATCH] Path builder working buffer has to be reinitialized every loop iteration, to clean it up from trash. --- engine/vfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/vfs.c b/engine/vfs.c index c8bddaf..191da3d 100644 --- a/engine/vfs.c +++ b/engine/vfs.c @@ -2890,12 +2890,12 @@ PH7_PRIVATE void *PH7_StreamOpenHandle(ph7_vm *pVm, const ph7_io_stream *pStream #else static const int c = '/'; #endif - /* Init the path builder working buffer */ - SyBlobInit(&sWorker, &pVm->sAllocator); /* Build a path from the set of include path */ SySetResetCursor(&pVm->aPaths); rc = SXERR_IO; while(SXRET_OK == SySetGetNextEntry(&pVm->aPaths, (void **)&pPath)) { + /* Init the path builder working buffer everytime to avoid trash */ + SyBlobInit(&sWorker, &pVm->sAllocator); /* Build full path */ SyBlobFormat(&sWorker, "%z%c%z", pPath, c, &sFile); /* Append null terminator */