From 3033d422be19421a0dc3cff7f15cd76bb14a11483fe6e91ffe763fc8619958b0 Mon Sep 17 00:00:00 2001
From: Sascha Peilicke <null@suse.de>
Date: Fri, 27 Sep 2013 07:38:03 +0000
Subject: [PATCH 1/3] Accepting request 200717 from
 home:tiwai:branches:multimedia:libs

- Fix double free in destructor of caps plugin (bnc#842420)

OBS-URL: https://build.opensuse.org/request/show/200717
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/ladspa?expand=0&rev=28
---
 caps-fix-double-free.diff | 21 +++++++++++++++++++
 ladspa-devel.spec         |  2 +-
 ladspa.changes            |  5 +++++
 ladspa.spec               | 44 +++++++++++++++++++++++++++++----------
 4 files changed, 60 insertions(+), 12 deletions(-)
 create mode 100644 caps-fix-double-free.diff

diff --git a/caps-fix-double-free.diff b/caps-fix-double-free.diff
new file mode 100644
index 0000000..6f01584
--- /dev/null
+++ b/caps-fix-double-free.diff
@@ -0,0 +1,21 @@
+---
+ interface.cc |    8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/interface.cc
++++ b/interface.cc
+@@ -123,8 +123,12 @@ void _init()
+ __attribute__ ((destructor)) 
+ void _fini()
+ {
+-	for (ulong i = 0; i < N; ++i)
+-		delete descriptors[i];
++	for (ulong i = 0; i < N; ++i) {
++		if (descriptors[i]) {
++			delete descriptors[i];
++			descriptors[i] = NULL;
++		}
++	}
+ }
+ 
+ /* /////////////////////////////////////////////////////////////////////// */
diff --git a/ladspa-devel.spec b/ladspa-devel.spec
index 3c1a2bf..d20aeca 100644
--- a/ladspa-devel.spec
+++ b/ladspa-devel.spec
@@ -1,7 +1,7 @@
 #
 # spec file for package ladspa-devel
 #
-# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
diff --git a/ladspa.changes b/ladspa.changes
index c8a9ea3..d66c509 100644
--- a/ladspa.changes
+++ b/ladspa.changes
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Thu Sep 26 14:37:25 CEST 2013 - tiwai@suse.de
+
+- Fix double free in destructor of caps plugin (bnc#842420)
+
 -------------------------------------------------------------------
 Tue Feb 14 07:51:10 UTC 2012 - coolo@suse.com
 
diff --git a/ladspa.spec b/ladspa.spec
index fa1028c..a8314f7 100644
--- a/ladspa.spec
+++ b/ladspa.spec
@@ -1,7 +1,7 @@
 #
 # spec file for package ladspa
 #
-# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -50,16 +50,34 @@ Release:        0
 AutoReq:        on
 Autoprov:       off
 Provides:       ladspa > 1.12.code10.3.1
-Provides:       ladspa-swh-plugins = %{swh_version} ladspa-AMB = %{AMB_version} ladspa-FIL = %{FIL_version}
-Provides:       ladspa-REV = %{REV_version} ladspa-VCO = %{VCO_version} ladspa-alienwah = %{alienwah_version}
-Provides:       ladspa-caps = %{caps_version} ladspa-pvoc = %{pvoc_version} ladspa-tap-plugins = %{tap_version}
-Provides:       ladspa-vlevel = %{vlevel_version} ladspa-vocoder = %{vocoder_version} ladspa-blop = %{blop_version}
-Provides:       ladspa-vcf = %{vcf_version} ladspa-MCP = %{MCP_version}
-Obsoletes:      ladspa-swh-plugins < %{swh_version} ladspa-AMB < %{AMB_version} ladspa-FIL < %{FIL_version}
-Obsoletes:      ladspa-REV < %{REV_version} ladspa-VCO < %{VCO_version} ladspa-alienwah < %{alienwah_version}
-Obsoletes:      ladspa-caps < %{caps_version} ladspa-pvoc < %{pvoc_version} ladspa-tap-plugins < %{tap_version}
-Obsoletes:      ladspa-vlevel < %{vlevel_version} ladspa-vocoder < %{vocoder_version} ladspa-blop < %{blop_version}
-Obsoletes:      ladspa-vcf < %{vcf_version} ladspa-MCP < %{MCP_version}
+Provides:       ladspa-AMB = %{AMB_version}
+Provides:       ladspa-FIL = %{FIL_version}
+Provides:       ladspa-MCP = %{MCP_version}
+Provides:       ladspa-REV = %{REV_version}
+Provides:       ladspa-VCO = %{VCO_version}
+Provides:       ladspa-alienwah = %{alienwah_version}
+Provides:       ladspa-blop = %{blop_version}
+Provides:       ladspa-caps = %{caps_version}
+Provides:       ladspa-pvoc = %{pvoc_version}
+Provides:       ladspa-swh-plugins = %{swh_version}
+Provides:       ladspa-tap-plugins = %{tap_version}
+Provides:       ladspa-vcf = %{vcf_version}
+Provides:       ladspa-vlevel = %{vlevel_version}
+Provides:       ladspa-vocoder = %{vocoder_version}
+Obsoletes:      ladspa-AMB < %{AMB_version}
+Obsoletes:      ladspa-FIL < %{FIL_version}
+Obsoletes:      ladspa-MCP < %{MCP_version}
+Obsoletes:      ladspa-REV < %{REV_version}
+Obsoletes:      ladspa-VCO < %{VCO_version}
+Obsoletes:      ladspa-alienwah < %{alienwah_version}
+Obsoletes:      ladspa-blop < %{blop_version}
+Obsoletes:      ladspa-caps < %{caps_version}
+Obsoletes:      ladspa-pvoc < %{pvoc_version}
+Obsoletes:      ladspa-swh-plugins < %{swh_version}
+Obsoletes:      ladspa-tap-plugins < %{tap_version}
+Obsoletes:      ladspa-vcf < %{vcf_version}
+Obsoletes:      ladspa-vlevel < %{vlevel_version}
+Obsoletes:      ladspa-vocoder < %{vocoder_version}
 Source1:        ladspa_sdk_1.13.tar.bz2
 Source2:        cmt_src_1.15.tar.bz2
 Source3:        swh-plugins-%{swh_version}.tar.bz2
@@ -116,6 +134,7 @@ Patch25:        pvoc-0.1.10-depend-copts-fix.diff
 Patch26:        swh-nostatic-lib.diff
 Patch27:        blop-ladspa_dir.diff
 Patch28:        blop-wdautil-fix.diff
+Patch29:        caps-fix-double-free.diff
 Url:            http://www.ladspa.org/
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
@@ -199,6 +218,9 @@ touch config.rpath
 %patch16
 %patch25
 )
+(cd caps-%{caps_version}
+%patch29 -p1
+)
 
 %build
 # This package failed when testing with -Wl,-as-needed being default.

From b9cbf30048e910b5ae18f94986bcd26f056638352879c4ef0044564a6137898f Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.com>
Date: Thu, 14 Nov 2013 06:49:33 +0000
Subject: [PATCH 2/3] - caps-fix-double-free.diff:   Fix double free in
 destructor of caps plugin (bnc#842420)

OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/ladspa?expand=0&rev=29
---
 ladspa.changes | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ladspa.changes b/ladspa.changes
index d66c509..59f55b9 100644
--- a/ladspa.changes
+++ b/ladspa.changes
@@ -1,7 +1,8 @@
 -------------------------------------------------------------------
 Thu Sep 26 14:37:25 CEST 2013 - tiwai@suse.de
 
-- Fix double free in destructor of caps plugin (bnc#842420)
+- caps-fix-double-free.diff:
+  Fix double free in destructor of caps plugin (bnc#842420)
 
 -------------------------------------------------------------------
 Tue Feb 14 07:51:10 UTC 2012 - coolo@suse.com

From 72fab9c9b07096181190c5fdabb2198da4e2c44cfa6136c1aa0106c2391ad4dc Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.com>
Date: Wed, 11 Dec 2013 10:51:06 +0000
Subject: [PATCH 3/3] Accepting request 209420 from
 home:tiwai:branches:multimedia:libs

- Merge ladspa-devel.spec into ladspa.spec; back to root, as OBS
  doesn't like split packages (the submitreq always declined),
  and the development activity of this package is pretty low, so
  no worth to resist

OBS-URL: https://build.opensuse.org/request/show/209420
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/ladspa?expand=0&rev=30
---
 ladspa-devel.changes | 15 ------------
 ladspa-devel.spec    | 55 --------------------------------------------
 ladspa.changes       |  8 +++++++
 ladspa.spec          | 23 +++++++++++++++---
 4 files changed, 28 insertions(+), 73 deletions(-)
 delete mode 100644 ladspa-devel.changes
 delete mode 100644 ladspa-devel.spec

diff --git a/ladspa-devel.changes b/ladspa-devel.changes
deleted file mode 100644
index 172f807..0000000
--- a/ladspa-devel.changes
+++ /dev/null
@@ -1,15 +0,0 @@
--------------------------------------------------------------------
-Thu Jan 21 07:27:40 UTC 2010 - davejplater@gmail.com
-
-- Update to 1.13
-
--------------------------------------------------------------------
-Wed Feb 13 13:50:30 CET 2008 - adrian@suse.de
-
-- remove NoSource flag according to our policy
-
--------------------------------------------------------------------
-Wed Apr 18 13:01:02 CEST 2007 - tiwai@suse.de
-
-- split ladspa-devel.spec to reduce the build dependency
-
diff --git a/ladspa-devel.spec b/ladspa-devel.spec
deleted file mode 100644
index d20aeca..0000000
--- a/ladspa-devel.spec
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# spec file for package ladspa-devel
-#
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
-#
-# All modifications and additions to the file contributed by third parties
-# remain the property of their copyright owners, unless otherwise agreed
-# upon. The license for this file, and modifications and additions to the
-# file, is the same license as for the pristine package itself (unless the
-# license for the pristine package is not an Open Source License, in which
-# case the license is the MIT License). An "Open Source License" is a
-# license that conforms to the Open Source Definition (Version 1.9)
-# published by the Open Source Initiative.
-
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
-#
-
-
-Name:           ladspa-devel
-Summary:        Include Files mandatory for Development
-License:        LGPL-2.1+
-Group:          Development/Libraries/C and C++
-Version:        1.13
-Release:        0
-Source:         ladspa_sdk_1.13.tar.bz2
-Url:            http://www.ladspa.org/
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildArch:      noarch
-Provides:       ladspa-devel > 1.12.code10.3.1
-
-%description
-This package contains include files to develop LADSPA plugins.
-
-%prep
-%setup -n ladspa_sdk
-
-%build
-
-%install
-mkdir -p $RPM_BUILD_ROOT%{_includedir}
-cp src/ladspa.h $RPM_BUILD_ROOT%{_includedir}
-mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}
-cp -av README $RPM_BUILD_ROOT%{_docdir}/%{name}
-cp -av doc/* $RPM_BUILD_ROOT%{_docdir}/%{name}
-ln -sf %{_includedir}/ladspa.h $RPM_BUILD_ROOT%{_docdir}/%{name}/ladspa.h.txt
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,root,root)
-%doc %{_docdir}/%{name}
-%{_includedir}/*
-
-%changelog
diff --git a/ladspa.changes b/ladspa.changes
index 59f55b9..e045e90 100644
--- a/ladspa.changes
+++ b/ladspa.changes
@@ -1,3 +1,11 @@
+-------------------------------------------------------------------
+Wed Dec  4 15:55:53 CET 2013 - tiwai@suse.de
+
+- Merge ladspa-devel.spec into ladspa.spec; back to root, as OBS
+  doesn't like split packages (the submitreq always declined),
+  and the development activity of this package is pretty low, so
+  no worth to resist
+
 -------------------------------------------------------------------
 Thu Sep 26 14:37:25 CEST 2013 - tiwai@suse.de
 
diff --git a/ladspa.spec b/ladspa.spec
index a8314f7..987afe2 100644
--- a/ladspa.spec
+++ b/ladspa.spec
@@ -144,6 +144,15 @@ ability to write simple plug-in audio processors in C/C++ and link them
 dynamically.  The package contains the LADSPA SDK, the CMT plug-in
 libraries (including Freeverb), and the swh plug-ins.
 
+%package devel
+Summary:        Include Files mandatory for Development
+Group:          Development/Libraries/C and C++
+BuildArch:      noarch
+Provides:       ladspa-devel > 1.12.code10.3.1
+
+%description devel
+This package contains include files to develop LADSPA plugins.
+
 %prep
 #
 # More URLs
@@ -414,8 +423,12 @@ cp -av vlevel-%{vlevel_version}/docs $RPM_BUILD_ROOT%{_docdir}/%{name}/vlevel
 mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}/examples/vlevel
 cp -av vlevel-%{vlevel_version}/utils/* $RPM_BUILD_ROOT%{_docdir}/%{name}/examples/vlevel
 chmod 644 $RPM_BUILD_ROOT%{_docdir}/%{name}/cmt/plugins.html
-# remove incldue file (already in devel package)
-rm -f $RPM_BUILD_ROOT%{_includedir}/*
+# devel package
+mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-devel
+cp -av ladspa_sdk/README $RPM_BUILD_ROOT%{_docdir}/%{name}-devel
+cp -av ladspa_sdk/doc/* $RPM_BUILD_ROOT%{_docdir}/%{name}-devel
+ln -sf %{_includedir}/ladspa.h $RPM_BUILD_ROOT%{_docdir}/%{name}-devel/ladspa.h.txt
+#
 %find_lang %{name} --all-name
 %fdupes -s $RPM_BUILD_ROOT
 
@@ -425,9 +438,13 @@ rm -rf $RPM_BUILD_ROOT
 %files -f %{name}.lang
 %defattr(-,root,root)
 %doc %{_docdir}/%{name}
-%doc %{_docdir}/%{name}/examples
 %{_libdir}/ladspa
 %{_bindir}/*
 %{_datadir}/ladspa
 
+%files devel
+%defattr(-,root,root)
+%doc %{_docdir}/%{name}-devel
+%{_includedir}/*
+
 %changelog