summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-03-02 11:36:30 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-03-02 11:36:30 +0100
commit53140e5c567af6cba0779e178394404f92213713 (patch)
tree35f9fab5e712bb1c4dd74abe639a4792bdd86cd6
parent2adf1c4d23467424012db1971d0a0a678d10d782 (diff)
downloadphp-git-53140e5c567af6cba0779e178394404f92213713.tar.gz
Fix #79333: com_print_typeinfo() leaks memory
We have to free the `ansiname`s, regardless of whether they have been put into the hashtable or not. Since bug79299.phpt already shows the leak when run with a leak checker, there is no need for another regression test.
-rw-r--r--NEWS1
-rw-r--r--ext/com_dotnet/com_typeinfo.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 3dd8545c44..1cdfac06bb 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ PHP NEWS
. Fixed bug #79299 (com_print_typeinfo prints duplicate variables). (Litiano
Moura)
. Fixed bug #79332 (php_istreams are never freed). (cmb)
+ . Fixed bug #79333 (com_print_typeinfo() leaks memory). (cmb)
- DOM:
. Fixed bug #77569: (Write Access Violation in DomImplementation). (Nikita,
diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c
index f3cecd82f5..794922d938 100644
--- a/ext/com_dotnet/com_typeinfo.c
+++ b/ext/com_dotnet/com_typeinfo.c
@@ -582,8 +582,8 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
ZVAL_STRINGL(&tmp, ansiname, ansinamelen);
zend_hash_index_update(id_to_name, func->memid, &tmp);
// TODO: avoid reallocation???
- efree(ansiname);
}
+ efree(ansiname);
}
ITypeInfo_ReleaseFuncDesc(typeinfo, func);
}