summaryrefslogtreecommitdiff
path: root/Lisp/libobjcl.lisp
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-02-11 18:36:17 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-02-11 18:36:17 +0100
commit31cd0253d521f458da739ac0b3c545a32bfadf03 (patch)
tree5cf2565e94ca73b18988ca4179285daf4632f2bd /Lisp/libobjcl.lisp
parentb36e4e6b194531e02dd55bb239087a50392e40db (diff)
Fix a bug that could cause FOREIGN-FREE to be called on a null pointer.
darcs-hash:3821d2debba27096f9fd8dcb630aace179ba4e9b
Diffstat (limited to 'Lisp/libobjcl.lisp')
-rw-r--r--Lisp/libobjcl.lisp17
1 files changed, 9 insertions, 8 deletions
diff --git a/Lisp/libobjcl.lisp b/Lisp/libobjcl.lisp
index fda484c..6e8e2f5 100644
--- a/Lisp/libobjcl.lisp
+++ b/Lisp/libobjcl.lisp
@@ -826,11 +826,12 @@ separating parts by hyphens works nicely in all of the `:INVERT`,
(let ((array-pointer (%objcl-class-direct-slots class-ptr
count-ptr
element-size-ptr)))
- (unwind-protect
- (loop with element-size = (mem-ref element-size-ptr :unsigned-int)
- with count = (mem-ref count-ptr :unsigned-int)
- for i from 0 below count
- for current-slot = array-pointer
- then (inc-pointer current-slot element-size)
- collecting (mem-ref current-slot :pointer))
- (foreign-free array-pointer)))))
+ (unless (null-pointer-p array-pointer)
+ (unwind-protect
+ (loop with element-size = (mem-ref element-size-ptr :unsigned-int)
+ with count = (mem-ref count-ptr :unsigned-int)
+ for i from 0 below count
+ for current-slot = array-pointer
+ then (inc-pointer current-slot element-size)
+ collecting (mem-ref current-slot :pointer))
+ (foreign-free array-pointer))))))