Browse Source

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

experimental/first_unicode_implementation
Felipe Pena 18 years ago
parent
commit
4a0956cf09
  1. 2
      ext/spl/spl_dllist.c
  2. 14
      ext/spl/tests/bug46160.phpt

2
ext/spl/spl_dllist.c

@ -816,6 +816,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;
}
@ -838,6 +839,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;
}

14
ext/spl/tests/bug46160.phpt

@ -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
Loading…
Cancel
Save