Wed Apr 8 17:18:53 CEST 2009 Tobias Rautenkranz * Free translated return values (fix memleak) diff -rN -u old-smoke/src/objects/stack.lisp new-smoke/src/objects/stack.lisp --- old-smoke/src/objects/stack.lisp 2014-10-04 08:11:33.000000000 +0200 +++ new-smoke/src/objects/stack.lisp 2014-10-04 08:11:33.000000000 +0200 @@ -117,12 +117,18 @@ (0 (let ((cffi-type (get-type (name type)))) (if (null cffi-type) (progn - ;(warn "Unknown translation from ~A to lisp." (name type)) + ;;(warn "Unknown translation from ~A to lisp." (name type)) (foreign-slot-value stack-item 'smoke-stack-item 'voidp)) - (convert-from-foreign (foreign-slot-value stack-item - 'smoke-stack-item - 'voidp) - cffi-type)))) + (let* ((pointer (foreign-slot-value stack-item + 'smoke-stack-item + 'voidp)) + (value (convert-from-foreign pointer cffi-type))) + (when (stack-p type) + ;; FIXME free-translated-object is not intended for this; + ;; param is NIL for now. + (cffi:free-translated-object pointer cffi-type nil)) + value + )))) (1 (foreign-slot-value stack-item 'smoke-stack-item 'bool)) (2 (code-char (foreign-slot-value stack-item 'smoke-stack-item 'char))) (3 (code-char (foreign-slot-value stack-item 'smoke-stack-item 'uchar)))