librz/type: fix memory leak in listing formats (#6448)

Co-authored-by: Anton Kochkov <anton.kochkov@gmail.com>
This commit is contained in:
NOT XVilka 2026-06-01 02:51:26 +08:00 committed by GitHub
parent 2de65410ef
commit e2a168905b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -690,7 +690,7 @@ static bool format_collect_cb(void *user, const char *k, const char *v) {
*/
RZ_API RZ_OWN RzList /*<RzTypeFormat *>*/ *rz_type_db_format_all(RzTypeDB *typedb) {
rz_return_val_if_fail(typedb, NULL);
RzList *formats = rz_list_new();
RzList *formats = rz_list_newf(free);
ht_ss_foreach(typedb->formats, format_collect_cb, formats);
return formats;
}