This memory leak can be reproduced using a tight loop to uci:get() a config.
lua -e 'require("posix"); require("uci");
function getconf()
local tmp, uc = uci.cursor();
tmp = uc:get("system", "ntp", "enable_server");
end;
while 1
do
for i=0,1000 do getconf() end;
print("gc");
print(collectgarbage("count"));
collectgarbage();
print(collectgarbage("count"));
print("sleep 1");
posix.sleep(1);
end'
err = UCI_ERR_INVAL;
goto error;
}
+ if (s)
+ free(s);
if (!err)
return 1;
goto error;
error:
+ if (s)
+ free(s);
return uci_push_status(L, ctx, false);
}
goto error;
error:
+ if (s)
+ free(s);
return uci_push_status(L, ctx, false);
}
error:
+ if (s)
+ free(s);
return uci_push_status(L, ctx, false);
}
}
err:
+ if (s)
+ free(s);
return uci_push_status(L, ctx, false);
}