q66 pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=cd29d76ce57071d5db7336d1bfd6471f8b2070bf
commit cd29d76ce57071d5db7336d1bfd6471f8b2070bf Author: Daniel Kolesa <[email protected]> Date: Wed Jun 11 11:12:27 2014 +0100 elua: fix coverity issues --- src/bin/elua/cache.c | 11 +++++++++-- src/bin/elua/io.c | 8 ++++++-- src/bin/elua/main.c | 4 +++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/bin/elua/cache.c b/src/bin/elua/cache.c index 7542978..a0496d4 100644 --- a/src/bin/elua/cache.c +++ b/src/bin/elua/cache.c @@ -19,13 +19,19 @@ check_bc(Eina_File *of, const char *fname, Eina_Bool *bc) /* original file doesn't exist, only bytecode does, use bytecode */ if (stat(fname, &sc_stat) < 0) return of; - stat(eina_file_filename_get(of), &bc_stat); + if (stat(eina_file_filename_get(of), &bc_stat) < 0) + { + /* what? */ + eina_file_close(of); + goto generate; + } /* bytecode is newer than original file, use bytecode */ if (bc_stat.st_mtime > sc_stat.st_mtime) return of; /* bytecode is not new enough; trigger regeneration */ eina_file_close(of); } +generate: *bc = EINA_TRUE; return eina_file_open(fname, EINA_FALSE); } @@ -63,7 +69,8 @@ write_bc(lua_State *L, const char *fname) if (lua_dump(L, writef, f)) { fclose(f); - remove(buf); + /* there really is nothing to handle here */ + (void)!!remove(buf); } else fclose(f); } diff --git a/src/bin/elua/io.c b/src/bin/elua/io.c index dc65ba4..d510044 100644 --- a/src/bin/elua/io.c +++ b/src/bin/elua/io.c @@ -67,6 +67,9 @@ elua_popen_c(const char *path, const char *md, const char *argv[]) #else ret = _popen(cmdline, md); #endif + + free(cmdline); + if (!ret) return NULL; return ret; @@ -204,6 +207,7 @@ elua_readline(lua_State *L) if (!f) { luaL_error(L, "file is already closed"); + return 0; /* shut up coverity; luaL_error does a longjmp */ } success = read_line(L, f); if (ferror(f)) @@ -357,8 +361,8 @@ elua_popen(lua_State *L) } else { - const char **argv = { NULL }; - *pf = elua_popen_c(fname, mode, argv); + const char *argv = NULL; + *pf = elua_popen_c(fname, mode, &argv); } return (!*pf) ? push_ret(L, 0, fname) : 1; } diff --git a/src/bin/elua/main.c b/src/bin/elua/main.c index 826f65f..39e316f 100644 --- a/src/bin/elua/main.c +++ b/src/bin/elua/main.c @@ -310,7 +310,9 @@ elua_build_args(lua_State *L) lua_pushvalue(L, i); ++n; lua_pushliteral(L, "'"); ++n; if (i != nargs) - lua_pushliteral(L, " "); ++n; + { + lua_pushliteral(L, " "); ++n; + } } lua_concat(L, n); return 1; --
