lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I am compiling Lua 5.1.5 using Visual Studio with PVS-Studio plugin.
He is complaining about the use of fs pointer in the function close_func (lparser.c:358)

The fs pointer is used before it was verified against nullptr.

  lparser.cpp
 358 FuncState *fs = ls->fs;
     Proto *f = fs->f;
     removevars(ls, 0);
     luaK_ret(fs, 0, 0);  /* final return */
     luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction);
     ...
 378 if (fs) anchor_token(ls);

I am not sure. But maybe anchor_token will always be reached.
The if is useless.

Thanks.

Vinicius Jarina.