aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/eg-sampler.lv2
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/eg-sampler.lv2')
-rw-r--r--plugins/eg-sampler.lv2/sampler.c5
-rw-r--r--plugins/eg-sampler.lv2/sampler_ui.c6
2 files changed, 7 insertions, 4 deletions
diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c
index 8e69bd5..38776c0 100644
--- a/plugins/eg-sampler.lv2/sampler.c
+++ b/plugins/eg-sampler.lv2/sampler.c
@@ -1,6 +1,6 @@
/*
LV2 Sampler Example Plugin
- Copyright 2011-2012 David Robillard <d@drobilla.net>
+ Copyright 2011-2016 David Robillard <d@drobilla.net>
Copyright 2011 Gabriel M. Beddingfield <gabriel@teuton.org>
Copyright 2011 James Morris <jwm.art.net@gmail.com>
@@ -258,11 +258,10 @@ instantiate(const LV2_Descriptor* descriptor,
const LV2_Feature* const* features)
{
// Allocate and initialise instance structure.
- Sampler* self = (Sampler*)malloc(sizeof(Sampler));
+ Sampler* self = (Sampler*)calloc(1, sizeof(Sampler));
if (!self) {
return NULL;
}
- memset(self, 0, sizeof(Sampler));
// Get host features
for (int i = 0; features[i]; ++i) {
diff --git a/plugins/eg-sampler.lv2/sampler_ui.c b/plugins/eg-sampler.lv2/sampler_ui.c
index c08930a..aff7e53 100644
--- a/plugins/eg-sampler.lv2/sampler_ui.c
+++ b/plugins/eg-sampler.lv2/sampler_ui.c
@@ -95,7 +95,11 @@ instantiate(const LV2UI_Descriptor* descriptor,
LV2UI_Widget* widget,
const LV2_Feature* const* features)
{
- SamplerUI* ui = (SamplerUI*)malloc(sizeof(SamplerUI));
+ SamplerUI* ui = (SamplerUI*)calloc(1, sizeof(SamplerUI));
+ if (!ui) {
+ return NULL;
+ }
+
ui->map = NULL;
ui->write = write_function;
ui->controller = controller;