Hi folks

I have a doubt.

QwtPlot *aQwtPlot = new QwtPlot;
QwtLegend *aQwtLegend = new QwtLegend;

Can we say that here we have a mem leak. i.e. memory allocated for aQwtLegend is not taken back (delete is not called) ?

I did look at this below piece of code. I think I should looking into autoDelete and it's default value.

if ( rtti == QwtPlotItem::Rtti_PlotItem || item->rtti() == rtti )
00172 {
00173 item->attach(NULL);
00174 if ( autoDelete )
00175 delete item;
00176 }

This is valgrind output I got.

==7469== at 0x4005C8C: operator new(unsigned) (vg_replace_malloc.c:163)
==7469== by 0x472A6FC: QLayout::addWidget(QWidget*) (qlayout.cpp:240)
==7469== by 0x444F765: QwtLegend::insert(QwtPlotItem const*, QWidget*) (in /usr/local/qwt/lib/libqwt.so.5.0.0)
==7469== by 0x445E326: QwtPlotItem::updateLegend(QwtLegend*) const (in /usr/local/qwt/lib/libqwt.so.5.0.0)
==7469== by 0x4457F6F: QwtPlotCurve::updateLegend(QwtLegend*) const (in /usr/local/qwt/lib/libqwt.so.5.0.0)
==7469== by 0x4453269: QwtPlot::insertLegend(QwtLegend*, QwtPlot::LegendPosition, double) (in /usr/local/qwt/lib/libqwt.so.5.0.0)