summaryrefslogtreecommitdiff
path: root/ui/qt
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2015-10-14 16:57:08 +0200
committerMichael Mann <mmann78@netscape.net>2015-10-22 12:30:52 +0000
commit1a383f8a8245c7baf142d8b3085c4f7f83a6e4a7 (patch)
treed20cfb07d2e06a4e1ddb1ff6baec1451d2aff3b9 /ui/qt
parentd9e530bc177553c07bae7594e9b4f8e6235fc0e0 (diff)
downloadwireshark-1a383f8a8245c7baf142d8b3085c4f7f83a6e4a7.tar.gz
qt: remove leak
Found by clang analyzer. Change-Id: If8bc72e1de276ae778ee3ac3e0dfc9dffa384c29 Reviewed-on: https://code.wireshark.org/review/11028 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/qcustomplot.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/ui/qt/qcustomplot.cpp b/ui/qt/qcustomplot.cpp
index eab739aa29..93344dffd8 100644
--- a/ui/qt/qcustomplot.cpp
+++ b/ui/qt/qcustomplot.cpp
@@ -7155,7 +7155,11 @@ bool QCPAbstractPlottable::addToLegend()
if (!mParentPlot->legend->hasItemWithPlottable(this))
{
- mParentPlot->legend->addItem(new QCPPlottableLegendItem(mParentPlot->legend, this));
+ QCPPlottableLegendItem* newitem(new QCPPlottableLegendItem(mParentPlot->legend, this));
+ if (!mParentPlot->legend->addItem(newitem)) {
+ delete newitem;
+ return false;
+ }
return true;
} else
return false;