1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00

- Fixed memory leak when calling the Finfo constructor twice

This commit is contained in:
Felipe Pena
2011-11-23 01:20:49 +00:00
parent d0839fc837
commit 9a98ccff5e
2 changed files with 27 additions and 0 deletions
+10
View File
@@ -289,6 +289,16 @@ PHP_FUNCTION(finfo_open)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lp", &options, &file, &file_len) == FAILURE) {
RETURN_FALSE;
}
if (object) {
struct finfo_object *finfo_obj = (struct finfo_object*)zend_object_store_get_object(object TSRMLS_CC);
if (finfo_obj->ptr) {
magic_close(finfo_obj->ptr->magic);
efree(finfo_obj->ptr);
finfo_obj->ptr = NULL;
}
}
if (file_len == 0) {
file = NULL;
+17
View File
@@ -0,0 +1,17 @@
--TEST--
FileInfo - Calling the constructor twice
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$x = new finfo;
$x->finfo();
echo "done!\n";
?>
--EXPECTF--
done!