Skip to content

Commit

Permalink
fix memory leak and crash on deleting measures
Browse files Browse the repository at this point in the history
  • Loading branch information
anatoly-os committed Aug 30, 2018
1 parent 209b5c7 commit 3598e95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions audiofile/audiofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ sf_count_t AudioFile::readData(short* data, sf_count_t frames)
//convert normalized floats to signed short values
for (int i = 0; i < totalFrames; ++i)
data[i] = adjScale * lrintf(dataF[i] * (dataF[i] > 0 ? SHRT_MAX : -SHRT_MIN));

delete[] dataF;
}

return resFrames;
Expand Down
2 changes: 1 addition & 1 deletion libmscore/undo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1616,8 +1616,8 @@ void InsertRemoveMeasures::removeMeasures()
}
auto i = std::find(system->measures().begin(), system->measures().end(), mb);
if (i != system->measures().end()) {
system->measures().erase(i);
(*i)->setParent(0);
system->measures().erase(i);
}
}
if (mb == fm)
Expand Down

0 comments on commit 3598e95

Please sign in to comment.