Skip to content

Commit 53140e5

Browse files
committed
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.
1 parent 2adf1c4 commit 53140e5

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ PHP NEWS
1515
. Fixed bug #79299 (com_print_typeinfo prints duplicate variables). (Litiano
1616
Moura)
1717
. Fixed bug #79332 (php_istreams are never freed). (cmb)
18+
. Fixed bug #79333 (com_print_typeinfo() leaks memory). (cmb)
1819

1920
- DOM:
2021
. Fixed bug #77569: (Write Access Violation in DomImplementation). (Nikita,

ext/com_dotnet/com_typeinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,8 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
582582
ZVAL_STRINGL(&tmp, ansiname, ansinamelen);
583583
zend_hash_index_update(id_to_name, func->memid, &tmp);
584584
// TODO: avoid reallocation???
585-
efree(ansiname);
586585
}
586+
efree(ansiname);
587587
}
588588
ITypeInfo_ReleaseFuncDesc(typeinfo, func);
589589
}

0 commit comments

Comments
 (0)