diff options
author | Harry van Haaren <harryhaaren@gmail.com> | 2018-05-19 14:15:15 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-05-21 10:14:14 +0200 |
commit | dc9ff1250c049b5b60cef16f07be4c031ce2fa4c (patch) | |
tree | 4213f00bc6e35022cb94750822ad7f3baba7b9fa | |
parent | fc332341acd2f5da4ba88e86d1bdbb47752c1688 (diff) | |
download | lv2-dc9ff1250c049b5b60cef16f07be4c031ce2fa4c.tar.xz |
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>
-rw-r--r-- | plugins/eg-sampler.lv2/sampler.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c index 3bd8b6c..aa8a1c1 100644 --- a/plugins/eg-sampler.lv2/sampler.c +++ b/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; } |