[Player-dev] CR-Client: Upgrade Experience URL "components" is garbage.
Daniel Yek dyek at real.comModified by: dyek at real.com Date: 06/29/2006 Project: Helix Player Bug Number: 5184 Bug URL: https://bugs.helixcommunity.org/show_bug.cgi?id=5184 Synopsis: The value of the "components" key in Upgrade Experience URL is garbage. Overview: The Upgrade Experience URL sometimes looks like this: https://.../redirect/?action=CheckUpdate&components=Hx%AE%08&playerVersion=10.1.0.2202... The "components" contains garbage. This is caused by upgrade.cpp hxplay_request_upgrade_dialog_new() freeing the string resulting in a dangling pointer: g_object_set_data(G_OBJECT(dialog), "components", uri_str->str); g_string_free(uri_str, TRUE); g_object_set_data() is associative table and the data can be any value (no memory management for data). The fix is to free only GString, but delay freeing the C string: g_string_free(uri_str, FALSE); The C string is freed in hxplay_request_upgrade_dialog_destroy(): g_free(g_object_get_data(G_OBJECT(dialog), "components")); This bug is in both Bingo and HEAD, but this code review is for HEAD only. The PR is for Bingo. Files Modified: player/app/gtk/upgrade.cpp - As described above. Image Size and Heap Use impact (Client -Only): None. Platforms and Profiles Affected: Linux Platforms and Profiles Build Verified: Profile: helix_client_all_define Platform: Fedora Core 5 Platforms and Profiles Functionality verified: Profile: helix_client_all_define Platform: Fedora Core 5 Branch: HEAD Copyright assignment: I am a RealNetworks employee. Index: upgrade.cpp =================================================================== RCS file: /cvsroot/player/app/gtk/upgrade.cpp,v retrieving revision 1.13 diff -u -w -r1.13 upgrade.cpp --- upgrade.cpp 13 Dec 2004 23:31:58 -0000 1.13 +++ upgrade.cpp 3 Aug 2006 09:57:04 -0000 @@ -101,6 +101,8 @@ { glade_xml_destroy (dialog->xml); + g_free(g_object_get_data(G_OBJECT(dialog), "components")); + g_free(dialog); } @@ -260,7 +262,7 @@ gtk_label_set_text(GTK_LABEL(url_label), url); g_string_free(str, TRUE); - g_string_free(uri_str, TRUE); + g_string_free(uri_str, FALSE); info = g_new0(HXUpgradeRequestDialog, 1); info->xml = xml; -- Daniel Yek