View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002873 | ardour | bugs | public | 2009-10-19 22:17 | 2020-04-19 20:14 |
| Reporter | cth103 | Assigned To | paul | ||
| Priority | normal | Severity | minor | Reproducibility | N/A |
| Status | closed | Resolution | fixed | ||
| Product Version | SVN/2.0-ongoing | ||||
| Summary | 0002873: [PATCH] a couple of valgrind-spotted transgressions | ||||
| Description | The attached patch fixes a couple of minor errors spotted by valgrind. The one in io.cc is the use of an iterator into a temporary variable, and the session_state.cc one is a mismatched free / delete. | ||||
| Tags | No tags attached. | ||||
|
2009-10-19 22:17
|
valgrind.patch (2,850 bytes)
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index f0a0cec..0678c4a 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -97,32 +97,34 @@ static double direct_gain_to_control (gain_t gain) {
static bool sort_ports_by_name (Port* a, Port* b) {
- unsigned int last_digit_position_a = a->name().size();
- std::string::reverse_iterator r_iterator = a->name().rbegin();
+ std::string const a_name = a->name();
+ unsigned int last_digit_position_a = a_name.size();
+ std::string::const_reverse_iterator r_iterator = a_name.rbegin();
- while (r_iterator!=a->name().rend() and Glib::Unicode::isdigit(*r_iterator)) {
+ while (r_iterator != a_name.rend() and Glib::Unicode::isdigit(*r_iterator)) {
r_iterator++; last_digit_position_a--;
}
- unsigned int last_digit_position_b = b->name().size();
- r_iterator = b->name().rbegin();
+ std::string const b_name = b->name();
+ unsigned int last_digit_position_b = b_name.size();
+ r_iterator = b_name.rbegin();
- while (r_iterator!=b->name().rend() and Glib::Unicode::isdigit(*r_iterator)) {
+ while (r_iterator != b_name.rend() and Glib::Unicode::isdigit(*r_iterator)) {
r_iterator++; last_digit_position_b--;
}
// if some of the names don't have a number as posfix, compare as strings
- if (last_digit_position_a == a->name().size() or last_digit_position_b == b->name().size()) {
- return a->name() < b->name();
+ if (last_digit_position_a == a_name.size() or last_digit_position_b == b_name.size()) {
+ return a_name < b_name;
}
- const std::string prefix_a = a->name().substr(0, last_digit_position_a - 1);
- const unsigned int posfix_a = std::atoi(a->name().substr(last_digit_position_a, a->name().size() - last_digit_position_a).c_str());
- const std::string prefix_b = b->name().substr(0, last_digit_position_b - 1);
- const unsigned int posfix_b = std::atoi(b->name().substr(last_digit_position_b, b->name().size() - last_digit_position_b).c_str());
+ const std::string prefix_a = a_name.substr(0, last_digit_position_a - 1);
+ const unsigned int posfix_a = std::atoi(a_name.substr(last_digit_position_a, a_name.size() - last_digit_position_a).c_str());
+ const std::string prefix_b = b_name.substr(0, last_digit_position_b - 1);
+ const unsigned int posfix_b = std::atoi(b_name.substr(last_digit_position_b, b_name.size() - last_digit_position_b).c_str());
if (prefix_a != prefix_b) {
- return a->name() < b->name();
+ return a_name < b_name;
} else {
return posfix_a < posfix_b;
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 0fde43b..54406c6 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -2542,7 +2542,7 @@ Session::get_route_templates (vector<RouteTemplateInfo>& template_names)
template_names.push_back (rti);
}
- free (templates);
+ delete templates;
}
int
|
|
|
committed. thanks as usual. |
|
|
Issue has been closed automatically, by Trigger Close Plugin. Feel free to re-open with additional information if you think the issue is not resolved. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2009-10-19 22:17 | cth103 | New Issue | |
| 2009-10-19 22:17 | cth103 | File Added: valgrind.patch | |
| 2009-10-19 22:17 | cth103 | cost | => 0.00 |
| 2009-10-19 22:17 | cth103 | Status | new => assigned |
| 2009-10-19 22:17 | cth103 | Assigned To | => paul |
| 2009-10-28 21:43 | paul | Note Added: 0006913 | |
| 2009-10-28 21:43 | paul | Status | assigned => resolved |
| 2009-10-28 21:43 | paul | Resolution | open => fixed |
| 2010-04-24 10:28 | cth103 | Category | bugs => bugs2 |
| 2010-04-24 10:31 | cth103 | Category | bugs2 => bugs |
| 2020-04-19 20:14 | system | Note Added: 0021993 | |
| 2020-04-19 20:14 | system | Status | resolved => closed |