diff options
Diffstat (limited to 'src/LV2Features.cpp')
-rw-r--r-- | src/LV2Features.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/LV2Features.cpp b/src/LV2Features.cpp index ebce8780..7d9003c0 100644 --- a/src/LV2Features.cpp +++ b/src/LV2Features.cpp @@ -37,12 +37,10 @@ LV2Features::add_feature(const std::shared_ptr<Feature>& feature) } LV2Features::FeatureArray::FeatureArray(FeatureVector& features) - : _features(features) + : _features(features) + , _array{static_cast<LV2_Feature**>( + calloc(features.size() + 1, sizeof(LV2_Feature*)))} { - _array = static_cast<LV2_Feature**>( - malloc(sizeof(LV2_Feature*) * (features.size() + 1))); - - _array[features.size()] = nullptr; for (size_t i = 0; i < features.size(); ++i) { _array[i] = features[i].get(); } @@ -73,7 +71,7 @@ LV2Features::lv2_features(World& world, Node* node) const { FeatureArray::FeatureVector vec; for (const auto& f : _features) { - std::shared_ptr<LV2_Feature> fptr = f->feature(world, node); + const std::shared_ptr<LV2_Feature> fptr = f->feature(world, node); if (fptr) { vec.push_back(fptr); } |