From 61a7c53a089b368cbed0c2c8f3a47cd170fdb808 Mon Sep 17 00:00:00 2001 From: theraven Date: Thu, 14 Jul 2011 21:10:59 +0000 Subject: [PATCH] Handle NULL arguments to block copy / release. --- blocks_runtime.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/blocks_runtime.m b/blocks_runtime.m index 9d694af..b1f472f 100644 --- a/blocks_runtime.m +++ b/blocks_runtime.m @@ -455,6 +455,7 @@ void _Block_object_dispose(const void *object, const int flags) // Copy a block to the heap if it's still on the stack or increments its retain count. void *_Block_copy(void *src) { + if (NULL == src) { return NULL; } fprintf(stderr, "_Block_copy()\n"); struct block_literal *self = src; struct block_literal *ret = self; @@ -485,6 +486,7 @@ void *_Block_copy(void *src) // Release a block and frees the memory when the retain count hits zero. void _Block_release(void *src) { + if (NULL == src) { return; } struct block_literal *self = src; extern void _NSConcreteStackBlock;