Plugin API passes memory ownership

Bug #814215 reported by William Good
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mixxx
Fix Released
Critical
William Good

Bug Description

The plugin API defines a function which returns a null-terminated array of c-style strings. This memory is allocated (by malloc) in the plugin, and then expected to be freed using free() in the calling code (SoundSourceProxy::something).

This works well where the plugin and mixxx binary are linked to the same C runtime DSO, as is typically the case in Linux, but Windows has more MSVCRT DSOs in the wild than the galaxy has stars (give or take) and different CRT DSOs can use different memory structures in their malloc implementation; this manifests itself in segmentation faults/access violations on plugin usage in Windows. Because we can't guarantee (and shouldn't expect) the two objects to be linked to the same CRT DSO, it's imperative that the unit allocating the memory also be responsible for freeing it; therefore, the plugin API must be modified
so that this is the case.

See https://code.launchpad.net/~mixxxdevelopers/mixxx/features_m4a_win7/+merge/67111

Related branches

William Good (bkgood)
description: updated
Revision history for this message
William Good (bkgood) wrote :

Changed to crit because if this is encountered segfault does happen. Fixed in lp:~mixxxdevelopers/mixxx/fixes-plugins-mempassing r2847.

Changed in mixxx:
importance: Medium → Critical
status: Confirmed → In Progress
RJ Skerry-Ryan (rryan)
Changed in mixxx:
status: In Progress → Fix Committed
RJ Skerry-Ryan (rryan)
Changed in mixxx:
status: Fix Committed → Fix Released
Revision history for this message
Swiftb0y (swiftb0y) wrote :

Mixxx now uses GitHub for bug tracking. This bug has been migrated to:
https://github.com/mixxxdj/mixxx/issues/5954

lock status: Metadata changes locked and limited to project staff
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.