After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 519698 - g_free/xmlFree mismatches in gstregistryxml
g_free/xmlFree mismatches in gstregistryxml
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other All
: Normal normal
: 0.10.18
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-03-01 09:19 UTC by Fabrizio Gennari
Modified: 2008-03-01 11:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for freeing strings with xmlFree rather than g_free when needed (893 bytes, patch)
2008-03-01 09:23 UTC, Fabrizio Gennari
committed Details | Review

Description Fabrizio Gennari 2008-03-01 09:19:17 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:
Comment 1 Fabrizio Gennari 2008-03-01 09:23:43 UTC
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.
Comment 2 Tim-Philipp Müller 2008-03-01 11:24:06 UTC
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).