diff options
author | David Robillard <d@drobilla.net> | 2016-07-31 17:57:39 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-07-31 17:57:39 -0400 |
commit | 2389e2a8781ce5b346ddacccb2a61b1da2cd8aab (patch) | |
tree | a523c41b5d3524855cb9ce4b9be664925dd9405c /plugins | |
parent | ad4303960ebda0d5d2fa08b5a7578c35d46b278d (diff) | |
download | lv2-2389e2a8781ce5b346ddacccb2a61b1da2cd8aab.tar.xz |
Fix memory leak
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/eg-sampler.lv2/sampler.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c index 5cc3c96..1557656 100644 --- a/plugins/eg-sampler.lv2/sampler.c +++ b/plugins/eg-sampler.lv2/sampler.c @@ -503,13 +503,14 @@ restore(LV2_Handle instance, // Schedule sample to be loaded by the provided worker lv2_log_trace(&self->logger, "Scheduling restore\n"); LV2_Atom_Forge forge; - LV2_Atom* buf = calloc(1, sizeof(LV2_Atom) * 32 + strlen(path)); + LV2_Atom* buf = (LV2_Atom*)calloc(1, strlen(path) + 128); lv2_atom_forge_init(&forge, self->map); lv2_atom_forge_set_sink(&forge, atom_sink, atom_sink_deref, buf); write_set_file(&forge, &self->uris, path, strlen(path)); const uint32_t msg_size = lv2_atom_pad_size(buf->size); schedule->schedule_work(self->schedule->handle, msg_size, buf + 1); + free(buf); } return LV2_STATE_SUCCESS; |