Hello,

I had a first look into the source code and also some small fixes for 
issues reported by valgrind.

In three cases a delete was used when a delete [] should have been:


midiseq.cpp L 183:

should be:

     delete [] _clockAveragerStages;


wavepreview.cpp L 28 + 29:

should be:
    delete [] tmpbuffer;
    delete [] srcbuffer;



Then a few questions:

in lv2host.cpp:

from lines 2289:

       if(_nPname != 0)
       {
          _portName = lilv_node_as_string(_nPname);
          lilv_node_free(_nPname);
       }


and then:

line 2335:

          cPorts->push_back(LV2ControlPort(_port, i, 0.0f, _portName, 
_portSym, _cType, isCVPort));


The thing is, valgrind reports reading from memory locations which have 
been freed. In this case it concerns the _portName variable which is 
just a const char* pointer.
Unfortunately, since the _nPname node is freed, the pointer points into 
garbage since no copy is returned, which could potentially lead to a 
crash. This is also for other variables kept, but pointing into a now 
deleted node.

So most probably the node should be freed later on in the code. It 
probably works most of the time when there are less allocations in 
between, but in multi-threaded, multi-core you never know.



By looking at this I saw that e.g. STL containers or things like the 
boost libraries or even QT Framework general stuff is not used much, so 
is there a design decision behind this?

Reason I ask is I come from a very different SW development area (I 
develop and maintain a mission control system which currently flies 6 
satellites) and, especially for allocation/dealloction, we rely heavily 
on STL/boost/Poco.

So are there some coding rules/principles/does and don'ts?

lg,
Michael

------------------------------------------------------------------------------
_______________________________________________
Lmuse-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lmuse-developer

Reply via email to