[xmp] Fix untimely g_free(filename) calls in Audacious 3 plugin and

Michael Schwendt mschwendt at fedoraproject.org
Fri Jun 15 13:37:42 UTC 2012


commit dea814add330089db4dabce0b674c63d0a817fa9
Author: Michael Schwendt <mschwendt at fedoraproject.org>
Date:   Fri Jun 15 15:37:41 2012 +0200

    Fix untimely g_free(filename) calls in Audacious 3 plugin and
    
      make module probing thread-safe.

 xmp-3.4.0-audacious-probe_for_tuple.patch |   51 ++++++++++++++++++++++++++---
 xmp.spec                                  |   10 +++--
 2 files changed, 52 insertions(+), 9 deletions(-)
---
diff --git a/xmp-3.4.0-audacious-probe_for_tuple.patch b/xmp-3.4.0-audacious-probe_for_tuple.patch
index 1cc7b4b..79a460a 100644
--- a/xmp-3.4.0-audacious-probe_for_tuple.patch
+++ b/xmp-3.4.0-audacious-probe_for_tuple.patch
@@ -1,7 +1,39 @@
 diff -Nurb --strip-trailing-cr xmp-3.4.0-orig/src/plugin/audacious3.c xmp-3.4.0/src/plugin/audacious3.c
 --- xmp-3.4.0-orig/src/plugin/audacious3.c	2012-06-15 13:51:40.650150003 +0200
-+++ xmp-3.4.0/src/plugin/audacious3.c	2012-06-15 14:27:32.896980189 +0200
-@@ -240,9 +240,9 @@
++++ xmp-3.4.0/src/plugin/audacious3.c	2012-06-15 15:34:22.493836696 +0200
+@@ -31,6 +31,7 @@
+ static GCond *seek_cond;
+ static gint jumpToTime = -1;
+ static gboolean stop_flag = FALSE;
++static GMutex *probe_mutex;
+ 
+ static xmp_context ctx;
+ 
+@@ -175,6 +176,7 @@
+ 	xmp_drv_register(&drv_smix);
+ 	ctx = xmp_create_context();
+ 
++    probe_mutex = g_mutex_new();
+ 	jumpToTime = -1;
+ 	seek_mutex = g_mutex_new();
+ 	seek_cond = g_cond_new();
+@@ -205,6 +207,7 @@
+ {
+ 	g_cond_free(seek_cond);
+ 	g_mutex_free(seek_mutex);
++    g_mutex_free(probe_mutex);
+ 	xmp_free_context(ctx);
+ }
+ 
+@@ -233,6 +236,7 @@
+ 	struct xmp_module_info mi;
+ 	struct xmp_options *opt;
+ 
++	g_mutex_lock(probe_mutex);
+ 	_D("filename = %s", filename);
+ 	strip_vfs(filename);		/* Sorry, no VFS support */
+ 
+@@ -240,16 +244,18 @@
  	opt = xmp_get_options(ctx);
  	opt->skipsmp = 1;	/* don't load samples */
  	len = xmp_load_module(ctx, filename);
@@ -10,9 +42,10 @@ diff -Nurb --strip-trailing-cr xmp-3.4.0-orig/src/plugin/audacious3.c xmp-3.4.0/
  	if (len < 0) {
 +        g_free(filename);
  		xmp_free_context(ctx);
++        g_mutex_unlock(probe_mutex);
  		return NULL;
  	}
-@@ -250,6 +250,7 @@
+ 
  	xmp_get_module_info(ctx, &mi);
  
  	tuple = tuple_new_from_filename(filename);
@@ -20,7 +53,15 @@ diff -Nurb --strip-trailing-cr xmp-3.4.0-orig/src/plugin/audacious3.c xmp-3.4.0/
  	tuple_set_str(tuple, FIELD_TITLE, NULL, mi.name);
  	tuple_set_str(tuple, FIELD_CODEC, NULL, mi.type);
  	tuple_set_int(tuple, FIELD_LENGTH, NULL, len);
-@@ -340,7 +341,6 @@
+@@ -257,6 +263,7 @@
+ 	xmp_release_module(ctx);
+ 	xmp_free_context(ctx);
+ 
++    g_mutex_unlock(probe_mutex);
+ 	return tuple;
+ }
+ 
+@@ -340,7 +347,6 @@
  	_D("*** loading: %s", filename);
  
  	lret =  xmp_load_module(ctx, filename);
@@ -28,7 +69,7 @@ diff -Nurb --strip-trailing-cr xmp-3.4.0-orig/src/plugin/audacious3.c xmp-3.4.0/
  
  	if (lret < 0) {
  		xmp_close_audio(ctx);
-@@ -351,6 +351,7 @@
+@@ -351,6 +357,7 @@
  	xmp_get_module_info(ctx, &xmp_cfg.mod_info);
  
  	tuple = tuple_new_from_filename(filename);
diff --git a/xmp.spec b/xmp.spec
index 3d1d364..eab0049 100644
--- a/xmp.spec
+++ b/xmp.spec
@@ -8,7 +8,7 @@
 
 Name: xmp
 Version: 3.4.0
-Release: 9%{?dist}
+Release: 10%{?dist}
 Summary: A multi-format module player
 Group: Applications/Multimedia
 #Source: http://downloads.sourceforge.net/sourceforge/xmp/xmp-%{version}.tar.gz
@@ -28,7 +28,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
 # any GUI elements with config section/name pairs directly
 Patch0: xmp-3.4.0-audacious-3.1.patch
 Patch1: xmp-3.4.0-audacious-3.2.patch
-# fix untimely g_free / will be reported to xmp devel list
+# fix untimely g_free calls and make probe_for_tuple thread-safe
+# (reported to xmp devel list)
 Patch2: xmp-3.4.0-audacious-probe_for_tuple.patch
 
 %description
@@ -114,8 +115,9 @@ rm -rf %{buildroot}
 %{xmms_input_plugin_dir}/*
 
 %changelog
-* Fri Jun 15 2012 Michael Schwendt <mschwendt at fedoraproject.org> - 3.4.0-9
-- Fix untimely g_free(filename) calls in Audacious 3 plugin.
+* Fri Jun 15 2012 Michael Schwendt <mschwendt at fedoraproject.org> - 3.4.0-10
+- Fix untimely g_free(filename) calls in Audacious 3 plugin and
+  make module probing thread-safe.
 
 * Mon Jun  4 2012 Michael Schwendt <mschwendt at fedoraproject.org> - 3.4.0-7
 - Fix undefined symbol corner-case for Audacious 3.2 API (#825937).


More information about the scm-commits mailing list