zhaozg/lua-openssl — Issue #6: memory leak using cipher:
Author: bfg
Created: 2012-02-21 17:26:14+00:00
State: open

The following code leaks memory really badly (2G per in 7 seconds)

```
require "openssl"

secret_key = "secret"
cipher = openssl.get_cipher("RC4")

num = 10000000
i = 1
while i <= num do
i = i+1

id = "something"

encrypted = cipher:encrypt(id, secret_key);
end
```

Lua environment:

```
$ uname -a
Linux pipi.dev.interseek.com 3.2.0-8-generic #14-Ubuntu SMP Fri Jan 6 01:56:48 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

$ lua -v
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio

$ luajit-2.0.0-beta9 -v
LuaJIT 2.0.0-beta9 -- Copyright (C) 2005-2011 Mike Pall. http://luajit.org/

$ openssl version
OpenSSL 1.0.0g 18 Jan 2012
```

Latest lua-openssl master