- MFH: Fixed bug #46160 (SPL - Memory leak when exception is throwed in offsetSet method)

This commit is contained in:
Felipe Pena 2008-09-23 12:06:01 +00:00
parent 169e68ed1a
commit 54231ab577
2 changed files with 16 additions and 0 deletions

View File

@ -818,6 +818,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet)
index = spl_offset_convert_to_long(zindex TSRMLS_CC);
if (index < 0 || index >= intern->llist->count) {
zval_ptr_dtor(&value);
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0 TSRMLS_CC);
return;
}
@ -840,6 +841,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet)
intern->llist->ctor(element TSRMLS_CC);
}
} else {
zval_ptr_dtor(&value);
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid", 0 TSRMLS_CC);
return;
}

View File

@ -0,0 +1,14 @@
--TEST--
Bug #46160 (SPL - Memory leak when exception is throwed in offsetSet method)
--FILE--
<?php
try {
$x = new splqueue;
$x->offsetSet(0, 0);
} catch (Exception $e) { }
?>
DONE
--EXPECT--
DONE