Fix a segfault when creating records
authorPieter Lexis <pieter.lexis@os3.nl>
Wed, 8 Feb 2012 14:04:08 +0000 (15:04 +0100)
committerPieter Lexis <pieter.lexis@os3.nl>
Wed, 8 Feb 2012 14:04:08 +0000 (15:04 +0100)
swede

diff --git a/swede b/swede
index cc2b21da04582ec839b9439a41c1f42faab50a40..10325c3fd9649491b22dce978f79e121e5da329c 100755 (executable)
--- a/swede
+++ b/swede
@@ -611,6 +611,13 @@ if __name__ == '__main__':
                                        else:
                                                print genTLSA(args.host, args.protocol, args.port, cert, args.output, args.usage, args.selector, args.mtype)
 
+                               # Clear the cert from memory (to stop M2Crypto from segfaulting)
+                               # And cleanup the connection and context
+                               cert=None
+                               connection.clear()
+                               connection.close()
+                               ctx.close()
+
                else: # Pass the path to the certificate to the genTLSA function
                        if args.output == 'both':
                                print genTLSA(args.host, args.protocol, args.port, args.certificate, 'draft', args.usage, args.selector, args.mtype)