--- libxml2-2.6.32/python/libxml.py	2007-03-09 16:53:48.000000000 +0000
+++ libxml2-2.6.32_changed/python/libxml.py	2008-05-22 07:01:13.453125000 +0100
@@ -432,9 +432,11 @@
         if doc == None:
             return None
         ctxt = doc.xpathNewContext()
-        ctxt.setContextNode(self)
-        res = ctxt.xpathEval(expr)
-        ctxt.xpathFreeContext()
+        try:
+            ctxt.setContextNode(self)
+            res = ctxt.xpathEval(expr)
+        finally:
+            ctxt.xpathFreeContext()
         return res
 
 #    #
