[pypy-svn] r78003 - pypy/branch/leak-finder/pypy/rpython/lltypesystem
arigo at codespeak.net
arigo at codespeak.net
Fri Oct 15 18:42:24 CEST 2010
Author: arigo
Date: Fri Oct 15 18:42:23 2010
New Revision: 78003
Modified:
pypy/branch/leak-finder/pypy/rpython/lltypesystem/rffi.py
Log:
Fix.
Modified: pypy/branch/leak-finder/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/branch/leak-finder/pypy/rpython/lltypesystem/rffi.py (original)
+++ pypy/branch/leak-finder/pypy/rpython/lltypesystem/rffi.py Fri Oct 15 18:42:23 2010
@@ -649,12 +649,13 @@
# if 'buf' points inside 'data'. This is only possible if we
# followed the 2nd case in get_nonmovingbuffer(); in the first case,
# 'buf' points to its own raw-malloced memory.
- data_start = cast_ptr_to_adr(llstrtype(data)) + \
+ data = llstrtype(data)
+ data_start = cast_ptr_to_adr(data) + \
offsetof(STRTYPE, 'chars') + itemoffsetof(STRTYPE.chars, 0)
- if buf != cast(TYPEP, data_start):
+ followed_2nd_path = (buf == cast(TYPEP, data_start))
+ keepalive_until_here(data)
+ if not followed_2nd_path:
lltype.free(buf, flavor='raw')
- else:
- keepalive_until_here(data)
# int -> (char*, str)
def alloc_buffer(count):
More information about the Pypy-commit
mailing list