summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2016-02-09 13:09:26 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2016-02-09 13:09:26 +0100
commiteddcef9d4b81041e883626044d9dae81f8d8d9d9 (patch)
treea040a86672f060b0ee7b0b476a30426bdc4ccb8a
parent0a2b49267f9002c7289e60654203e9b108c06f73 (diff)
Fix two valgrind errors and mark three others with a TODO comment.
-rw-r--r--drumgizmo/input/midifile.cc2
-rw-r--r--src/audiofile.cc2
-rw-r--r--src/instrumentparser.cc2
-rw-r--r--src/memchecker.cc2
4 files changed, 5 insertions, 3 deletions
diff --git a/drumgizmo/input/midifile.cc b/drumgizmo/input/midifile.cc
index 9e342e9..6429c8f 100644
--- a/drumgizmo/input/midifile.cc
+++ b/drumgizmo/input/midifile.cc
@@ -195,7 +195,7 @@ event_t* MidifileInputEngine::run(size_t pos, size_t len, size_t* nevents)
{
if(evs == nullptr)
{
- // todo: get rid of malloc
+ // TODO: get rid of malloc
evs = (event_t*)malloc(sizeof(event_t) * 1000);
}
evs[num_events].type = TYPE_STOP;
diff --git a/src/audiofile.cc b/src/audiofile.cc
index b0ad4da..f5d55b0 100644
--- a/src/audiofile.cc
+++ b/src/audiofile.cc
@@ -85,7 +85,7 @@ void AudioFile::load(int num_samples)
return;
}
- SF_INFO sf_info;
+ SF_INFO sf_info{};
SNDFILE *fh = sf_open(filename.c_str(), SFM_READ, &sf_info);
if(!fh)
{
diff --git a/src/instrumentparser.cc b/src/instrumentparser.cc
index 1f25bc7..8fa147a 100644
--- a/src/instrumentparser.cc
+++ b/src/instrumentparser.cc
@@ -90,6 +90,7 @@ void InstrumentParser::startTag(std::string name,
DEBUG(instrparser, "Instrument power set to %f\n", power);
}
+ // TODO get rid of new or delete it properly
s = new Sample(attr["name"], power);
}
@@ -117,6 +118,7 @@ void InstrumentParser::startTag(std::string name,
}
}
filechannel = filechannel - 1; // 1-based in file, but zero-based internally
+ // TODO do those next two lines correspond with proper deletes? If not fix it.
AudioFile *af = new AudioFile(path + "/" + attr["file"], filechannel);
InstrumentChannel *ch = new InstrumentChannel(attr["channel"]);
channellist.push_back(ch);
diff --git a/src/memchecker.cc b/src/memchecker.cc
index 8c8c183..8277212 100644
--- a/src/memchecker.cc
+++ b/src/memchecker.cc
@@ -87,7 +87,7 @@ uint64_t MemChecker::calcNeededMemory(const DrumKit& drumkit) const
uint64_t MemChecker::calcBytesPerChannel(const std::string& filename) const
{
- SF_INFO sf_info;
+ SF_INFO sf_info{};
SNDFILE* f = sf_open(filename.c_str(), SFM_READ, &sf_info);
if(!f)