From 09466bc44da4d0d7f0a722f298e28643309a0ace Mon Sep 17 00:00:00 2001 From: Nathan Owens Date: Tue, 1 Jan 2019 00:15:40 -0600 Subject: [PATCH] lv2: fix memory leak and segfault --- srcpkgs/lv2/patches/fix-memory-leak.patch | 25 ++++++++++++++ srcpkgs/lv2/patches/fix-segfault.patch | 42 +++++++++++++++++++++++ srcpkgs/lv2/template | 8 ++--- 3 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 srcpkgs/lv2/patches/fix-memory-leak.patch create mode 100644 srcpkgs/lv2/patches/fix-segfault.patch diff --git a/srcpkgs/lv2/patches/fix-memory-leak.patch b/srcpkgs/lv2/patches/fix-memory-leak.patch new file mode 100644 index 0000000000..6615f8a099 --- /dev/null +++ b/srcpkgs/lv2/patches/fix-memory-leak.patch @@ -0,0 +1,25 @@ +From f8fdd7a48d12465d2ef8153d25337593c88687e3 Mon Sep 17 00:00:00 2001 +From: David Robillard +Date: Sun, 12 Feb 2017 18:20:31 +0100 +Subject: Fix memory leak + +--- + plugins/eg-sampler.lv2/sampler.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git plugins/eg-sampler.lv2/sampler.c plugins/eg-sampler.lv2/sampler.c +index ca92a9c..95cb45e 100644 +--- plugins/eg-sampler.lv2/sampler.c ++++ plugins/eg-sampler.lv2/sampler.c +@@ -564,6 +564,8 @@ restore(LV2_Handle instance, + free(buf); + } + ++ free(path); ++ + return LV2_STATE_SUCCESS; + } + +-- +cgit v1.2.1 + diff --git a/srcpkgs/lv2/patches/fix-segfault.patch b/srcpkgs/lv2/patches/fix-segfault.patch new file mode 100644 index 0000000000..b2de914d9f --- /dev/null +++ b/srcpkgs/lv2/patches/fix-segfault.patch @@ -0,0 +1,42 @@ +From dc9ff1250c049b5b60cef16f07be4c031ce2fa4c Mon Sep 17 00:00:00 2001 +From: Harry van Haaren +Date: Sat, 19 May 2018 14:15:15 +0100 +Subject: eg-sampler: Fix segfault on old_sample null deref + +Fixes a segmentation fault in eg-sampler when a sample is loaded for the first +time. Dereferencing old_sample->path causes the NULL pointer segfault. + +Resolved by always simplifying code to always write_set_file, +even if the filename is the same. + +Signed-off-by: Harry van Haaren +--- + plugins/eg-sampler.lv2/sampler.c | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +diff --git plugins/eg-sampler.lv2/sampler.c plugins/eg-sampler.lv2/sampler.c +index 3bd8b6c..aa8a1c1 100644 +--- plugins/eg-sampler.lv2/sampler.c ++++ plugins/eg-sampler.lv2/sampler.c +@@ -220,13 +220,11 @@ work_response(LV2_Handle instance, + old_sample }; + self->schedule->schedule_work(self->schedule->handle, sizeof(msg), &msg); + +- if (strcmp(old_sample->path, new_sample->path)) { +- // Send a notification that we're using a new sample +- lv2_atom_forge_frame_time(&self->forge, self->frame_offset); +- write_set_file(&self->forge, &self->uris, +- new_sample->path, +- new_sample->path_len); +- } ++ // Send a notification that we're using a new sample ++ lv2_atom_forge_frame_time(&self->forge, self->frame_offset); ++ write_set_file(&self->forge, &self->uris, ++ new_sample->path, ++ new_sample->path_len); + + return LV2_WORKER_SUCCESS; + } +-- +cgit v1.2.1 + diff --git a/srcpkgs/lv2/template b/srcpkgs/lv2/template index d223e79d58..5dcc946a36 100644 --- a/srcpkgs/lv2/template +++ b/srcpkgs/lv2/template @@ -1,17 +1,17 @@ # Template file for 'lv2' pkgname=lv2 version=1.14.0 -revision=1 -lib32disabled=yes +revision=2 build_style=waf -homepage="http://lv2plug.in" hostmakedepends="python" makedepends="libsndfile-devel gtk+-devel" short_desc="Plugin standard for audio systems" maintainer="Juan RP " -license="LGPL-2.1, BSD" +license="ISC" +homepage="http://lv2plug.in" distfiles="http://lv2plug.in/spec/${pkgname}-${version}.tar.bz2" checksum=b8052683894c04efd748c81b95dd065d274d4e856c8b9e58b7c3da3db4e71d32 +lib32disabled=yes post_install() { vlicense COPYING