diff options
author | Aleš Matěj <amatej@redhat.com> | 2022-02-22 12:34:44 +0300 |
---|---|---|
committer | Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com> | 2022-03-07 17:55:06 +0300 |
commit | b9daab0738b58e5477326b39372bf11d302f0c4d (patch) | |
tree | 55ea8ae94dd0021843a29d45984d2be8ed21278e | |
parent | ace4c87a392b8c25fd7127da49516dba52d397c9 (diff) |
Free `in_progress_pkgs_list` fully only when there is no newpkgcb
Normally the `in_progress_pkgs_list` is empty (all packages get parsed
and processed) however there are cases such as hitting an error or
interrupting parsing when there can be packages present.
If there are packages we can free them only if there is no newpkgcb
because otherwise their references are stored in python layer which then
also tries to free them leading to a crash.
-rw-r--r-- | src/xml_parser_main_metadata_together.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/xml_parser_main_metadata_together.c b/src/xml_parser_main_metadata_together.c index 863c69e..f2632a2 100644 --- a/src/xml_parser_main_metadata_together.c +++ b/src/xml_parser_main_metadata_together.c @@ -462,7 +462,11 @@ out: if (allow_out_of_order) { g_hash_table_destroy(cbdata.in_progress_pkgs_hash); } else { - cr_slist_free_full(cbdata.in_progress_pkgs_list, (GDestroyNotify) cr_package_free); + if (cbdata.newpkgcb) { + g_slist_free(cbdata.in_progress_pkgs_list); + } else { + cr_slist_free_full(cbdata.in_progress_pkgs_list, (GDestroyNotify) cr_package_free); + } } return ret; |