lv2: fix memory leak and segfault

This commit is contained in:
Nathan Owens 2019-01-01 00:15:40 -06:00 committed by maxice8
parent cb1ba97f1f
commit 09466bc44d
3 changed files with 71 additions and 4 deletions

View file

@ -0,0 +1,25 @@
From f8fdd7a48d12465d2ef8153d25337593c88687e3 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
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

View file

@ -0,0 +1,42 @@
From dc9ff1250c049b5b60cef16f07be4c031ce2fa4c Mon Sep 17 00:00:00 2001
From: Harry van Haaren <harryhaaren@gmail.com>
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 <harryhaaren@gmail.com>
---
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

View file

@ -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 <xtraeme@voidlinux.eu>"
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