diff options
author | Dario Lombardo <lomato@gmail.com> | 2015-10-14 16:57:08 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-10-22 12:30:52 +0000 |
commit | 1a383f8a8245c7baf142d8b3085c4f7f83a6e4a7 (patch) | |
tree | d20cfb07d2e06a4e1ddb1ff6baec1451d2aff3b9 /ui/qt | |
parent | d9e530bc177553c07bae7594e9b4f8e6235fc0e0 (diff) | |
download | wireshark-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.cpp | 6 |
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; |