[pypy-svn] r75885 - pypy/branch/fast-ctypes/pypy/rlib

getxsick at codespeak.net getxsick at codespeak.net
Tue Jul 6 11:10:59 CEST 2010


Author: getxsick
Date: Tue Jul  6 11:10:58 2010
New Revision: 75885

Modified:
   pypy/branch/fast-ctypes/pypy/rlib/rjitffi.py
Log:
free memory to avoid memory leaks (thanks amaury)


Modified: pypy/branch/fast-ctypes/pypy/rlib/rjitffi.py
==============================================================================
--- pypy/branch/fast-ctypes/pypy/rlib/rjitffi.py	(original)
+++ pypy/branch/fast-ctypes/pypy/rlib/rjitffi.py	Tue Jul  6 11:10:58 2010
@@ -21,10 +21,13 @@
 
 class _LibHandler(object):
     def __init__(self, name):
+        name_ptr = rffi.str2charp(name)
         try:
-            self.handler = rdynload.dlopen(rffi.str2charp(name))
+            self.handler = rdynload.dlopen(name_ptr)
         except rdynload.DLOpenError, e:
             raise OSError('%s: %s', name, e.msg or 'unspecified error')
+        finally:
+            rffi.free_charp(name_ptr)
 
 class _Get(object):
     def __init__(self, cpu, lib, func, args_type, res_type='v'):



More information about the Pypy-commit mailing list