Skip to content

Conversation

@devnexen
Copy link
Contributor

@devnexen devnexen commented Apr 9, 2017

No description provided.

@jasp00
Copy link
Member

jasp00 commented Apr 9, 2017

This patch is wrong because you are not supposed to free const memory. You should try a different approach.

Copy link
Member

@jasp00 jasp00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should try an approach that respects const.

param_count = md->get_param_count(); // XXXKF ladspa_instance<Module>::real_param_count();

const ladspa_plugin_info &plugin_info = md->get_plugin_info();
std::string strName(plugin_info.name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use spaces in this file.

strcpy(Name, strName.c_str());
descriptor.UniqueID = plugin_info.unique_id;
descriptor.Label = plugin_info.label;
descriptor.Name = strdup((std::string(plugin_info.name) + " LADSPA").c_str());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strdup is fine. You just need to save the result somewhere else. It is not as efficient, but correctness is more important.

delete []descriptor.PortNames;
delete []descriptor.PortDescriptors;
delete []descriptor.PortRangeHints;
delete []descriptor.Name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are not supposed to delete const memory.

delete preset_descs;
free(descriptorForDssiName);
#endif
delete metadata;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

metadata is const. You should go to the point where metadata is created, make sure you keep a reference, and release it on destruction; you may need a function with __attribute__((destructor)).

@Umcaruje Umcaruje added this to the 1.3.0 milestone May 14, 2017
@tresf
Copy link
Member

tresf commented Nov 15, 2017

@devnexen I'm sorry this took so long to review, the original reviewer is no longer with the project. Calf has been moved to a submodule since #3940 and I missed this patch.

Currently @JohannesLorenz is working on getting Calf updated to 0.90, so this patch could have a home in either the current 0.18~ish version on the ladspa branch or the 0.90 version on the master branch.

Closing since the code this PR is against is no longer part of the LMMS codebase.

@tresf tresf closed this Nov 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants