case 4:
/* Format: uci.set("p", "s", "o", "v") */
if (lua_istable(L, nargs)) {
- if (lua_rawlen(L, nargs) < 1)
+ if (lua_rawlen(L, nargs) < 1) {
+ free(s);
return luaL_error(L, "Cannot set an uci option to an empty table value");
+ }
lua_rawgeti(L, nargs, 1);
ptr.value = luaL_checkstring(L, -1);
lua_pop(L, 1);
$ cp -R "$TESTDIR/config" .
$ export CONFIG_DIR=$(pwd)/config
$ ucilua $TESTDIR/lua/test_cases/changes_doesnt_leak.lua
+
+check that set method with empty table value doesn't leak memory:
+
+ $ cp -R "$TESTDIR/config" .
+ $ export CONFIG_DIR=$(pwd)/config
+ $ ucilua $TESTDIR/lua/test_cases/set_with_empty_table_doesnt_leak.lua
+ false\tCannot set an uci option to an empty table value (esc)