From: Michael Wallner Date: Mon, 4 Dec 2006 08:21:55 +0000 (+0000) Subject: - fix SEGV on un/serializing HttpRequests X-Git-Tag: RELEASE_1_4_0RC1~6 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=bed6be7b39b7992b44eb56455afe3f0b0bd04964;p=m6w6%2Fext-http - fix SEGV on un/serializing HttpRequests --- diff --git a/http_message_object.c b/http_message_object.c index 3adbb27..a04cfe9 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -1278,8 +1278,12 @@ PHP_METHOD(HttpMessage, unserialize) getObject(http_message_object, obj); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized, &length)) { + http_message *msg; + http_message_dtor(obj->message); - if (!http_message_parse_ex(obj->message, serialized, (size_t) length)) { + if ((msg = http_message_parse_ex(obj->message, serialized, (size_t) length))) { + obj->message = msg; + } else { http_error(HE_ERROR, HTTP_E_RUNTIME, "Could not unserialize HttpMessage"); http_message_init(obj->message); }