summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhaedrus Leeds <mwleeds@protonmail.com>2021-05-02 16:21:05 -0500
committerAlexander Larsson <alexander.larsson@gmail.com>2021-05-04 10:23:13 +0200
commit879c9b90089d5a94b90e10792e9ab58004d3d321 (patch)
tree17a4dc8892e7fc3e967d7b9bb785aaae3c048871
parentbc27dcb518d04bf7c2d5c6045877fcdde62f3da5 (diff)
downloadflatpak-879c9b90089d5a94b90e10792e9ab58004d3d321.tar.gz
utils: Fix use-after-free and logic error
Without this change, validate_component() might free the "component" variable, but then go on to keep using it. This change also makes the code work as intended, to only have a flatpak-specific "bundle" in the appstream xml (where here bundle does not mean "flatpak single-file bundle").
-rw-r--r--common/flatpak-utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c
index 4a765fe1..f577d6e0 100644
--- a/common/flatpak-utils.c
+++ b/common/flatpak-utils.c
@@ -5087,7 +5087,7 @@ validate_component (FlatpakXml *component,
}
while ((bundle = flatpak_xml_find (component, "bundle", &prev)) != NULL)
- flatpak_xml_free (flatpak_xml_unlink (component, bundle));
+ flatpak_xml_free (flatpak_xml_unlink (bundle, prev));
bundle = flatpak_xml_new ("bundle");
bundle->attribute_names = g_new0 (char *, 2 * 4);