GNOME Bugzilla – Bug 519698
g_free/xmlFree mismatches in gstregistryxml
Last modified: 2008-03-01 11:24:06 UTC
Please describe the problem: There are some cases in which gstregistryxml allocates strings using libxml2, which therefore need to be freed with xmlFree, and frees them with g_free instead. libxml2 does not depend on GLib, and this mismatch could cause crashes when the two libraries use 2 different implementations of malloc/free Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Created attachment 106320 [details] [review] Patch for freeing strings with xmlFree rather than g_free when needed Here is a fix for the cases I've found, there can be more but that was enough to prevent the app from crashing. I was using GStreamer under Win32, GLib was compiled to use MS CRT as DLL, and libxml2 had the C runtime compiled as static library. That's why the mismatches were causing crashes.
Thanks, committed: 2008-03-01 Tim-Philipp Müller <tim at centricular dot net> Patch by: Fabrizio Gennari <fabrizio.ge at tiscali it> * gst/gstregistryxml.c: (read_string), (load_feature): Strings allocated by libxml2 should be freed with xmlFree(), not with g_free(). Fixes issues on windows in certain contexts (#519698).