Path builder working buffer has to be reinitialized every loop iteration, to clean it up from trash.

This commit is contained in:
Rafal Kupiec 2018-07-23 19:43:04 +02:00
parent 52d9616503
commit 3ed00e610f
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 2 additions and 2 deletions

View File

@ -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 */