The memory leaking is something I hadn't thought of. I'm pretty sure it would only be a one-time leak (not per-call) but to soothe my worries I've attached a new patch, which avoids string eval entirely. I also suggest a stricter regex in another place to avoid nasty surprises. (See attached file: fix2.diff)
fix2.diff
Description: Binary data
