Fixing memory leaks in the SWIG wrapper.

There are some memory leaks in the SWIG wrapper here that I'm trying to get fixed for a while already (see http://bugzilla.osafoundation.org/show_bug.cgi?id=13005 ).

We are using M2Crypto in GRR ( https://code.google.com/p/grr/ ) and without this patch, it's basically unusable since we do lots of crypto operations and run out of memory immediately. We are providing a patch to fix this for our users but the installation process is a pain - having this fixed properly would be a huge win. Please have a look at this patch...