On Wednesday, August 17, 2016 8:12:10 PM EDT termtech wrote:
> On Wednesday, August 17, 2016 9:45:09 PM EDT Michael Oswald wrote:
> > 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;
>
> Fixed in git master.
> Thanks. ++credit in the ChangeLog.
>
> > 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.
>
> [@ Andrew] if you are watching, I hope this wasn't the type of thing
> you meant when you said you had to hack LV2? I recall you said
> something like that about memory problems.
>
> Darn, I had hoped that by replacing the older built-in LV2 versions
> with updated 'stock' or system version (user's configure choice)
> that all would be well.
>
> [@ Michael ] I made changes there recently, replacing Andrew's
> LV2 version with a more recent 'stock' version.
>
> I'll have to compare with old releases since I wiped out the old version.
> I wonder if this is what Andrew fixed.
False alarm, sorry for the noise.
Should have read the issue more closely.
Fix applied to git master.
In LV2Synth ctor, free _nPname later.
Try it out, let me know if any more valgrind trouble.
Thanks.
Tim.
------------------------------------------------------------------------------
_______________________________________________
Lmuse-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lmuse-developer