From: Michael Wallner Date: Wed, 3 Oct 2007 06:26:02 +0000 (+0000) Subject: - fix SEGV on prematurely called HttpMessage::next() X-Git-Tag: RELEASE_1_6_0RC1~5 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=9f4226597c09ccdf74db2be0ef76d9e135e7c71c;p=m6w6%2Fext-http - fix SEGV on prematurely called HttpMessage::next() --- diff --git a/http_message_object.c b/http_message_object.c index 45be49b..b6d8de2 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -1494,16 +1494,18 @@ PHP_METHOD(HttpMessage, next) { NO_ARGS { getObject(http_message_object, obj); - getObjectEx(http_message_object, itr, obj->iterator); - - if (itr && itr->parent.handle) { - zval *old = obj->iterator; - MAKE_STD_ZVAL(obj->iterator); - ZVAL_OBJVAL(obj->iterator, itr->parent, 1); - zval_ptr_dtor(&old); - } else { - zval_ptr_dtor(&obj->iterator); - obj->iterator = NULL; + if (obj->iterator) { + getObjectEx(http_message_object, itr, obj->iterator); + + if (itr && itr->parent.handle) { + zval *old = obj->iterator; + MAKE_STD_ZVAL(obj->iterator); + ZVAL_OBJVAL(obj->iterator, itr->parent, 1); + zval_ptr_dtor(&old); + } else { + zval_ptr_dtor(&obj->iterator); + obj->iterator = NULL; + } } } }