diff options
author | Felipe Pena <felipe@php.net> | 2008-09-23 12:06:01 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2008-09-23 12:06:01 +0000 |
commit | 54231ab5778e24715c3080a66f2fe50e8dc35726 (patch) | |
tree | 090c88414be156695474052e49453499e8324a00 /ext/spl | |
parent | 169e68ed1aa0b149308f62609698dbb67773c444 (diff) | |
download | php-git-54231ab5778e24715c3080a66f2fe50e8dc35726.tar.gz |
- MFH: Fixed bug #46160 (SPL - Memory leak when exception is throwed in offsetSet method)
Diffstat (limited to 'ext/spl')
-rw-r--r-- | ext/spl/spl_dllist.c | 2 | ||||
-rw-r--r-- | ext/spl/tests/bug46160.phpt | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 536a02532c..a1dcbab3cd 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -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; } diff --git a/ext/spl/tests/bug46160.phpt b/ext/spl/tests/bug46160.phpt new file mode 100644 index 0000000000..e4dbdff192 --- /dev/null +++ b/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 |