Commit 2e859a46 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix mem leak found by ASAN

parent 5361e4e4
Pipeline #25227 passed with stage
in 17 minutes and 4 seconds
......@@ -57,15 +57,16 @@ using namespace Kleo;
using namespace Kleo::SmartCard;
using namespace Kleo::Commands;
NetKeyWidget::NetKeyWidget() :
mSerialNumber(new QLabel),
mVersionLabel(new QLabel),
mLearnKeysLabel(new QLabel),
mErrorLabel(new QLabel),
NetKeyWidget::NetKeyWidget(QWidget *parent) :
QWidget(parent),
mSerialNumber(new QLabel(this)),
mVersionLabel(new QLabel(this)),
mLearnKeysLabel(new QLabel(this)),
mErrorLabel(new QLabel(this)),
mNullPinWidget(new NullPinWidget()),
mLearnKeysBtn(new QPushButton),
mChangeNKSPINBtn(new QPushButton),
mChangeSigGPINBtn(new QPushButton),
mLearnKeysBtn(new QPushButton(this)),
mChangeNKSPINBtn(new QPushButton(this)),
mChangeSigGPINBtn(new QPushButton(this)),
mTreeView(new KeyTreeView(this)),
mArea(new QScrollArea)
{
......@@ -172,6 +173,10 @@ NetKeyWidget::NetKeyWidget() :
vLay->addStretch(1);
}
NetKeyWidget::~NetKeyWidget()
{
}
void NetKeyWidget::setCard(const NetKeyCard* card)
{
mVersionLabel->setText(i18nc("1 is a Version number", "NetKey v%1 Card", card->appVersion()));
......
......@@ -54,7 +54,8 @@ class NetKeyWidget: public QWidget
{
Q_OBJECT
public:
NetKeyWidget();
explicit NetKeyWidget(QWidget *parent = nullptr);
~NetKeyWidget();
void setCard(const SmartCard::NetKeyCard* card);
......
......@@ -48,7 +48,8 @@
using namespace Kleo;
using namespace Kleo::SmartCard;
NullPinWidget::NullPinWidget()
NullPinWidget::NullPinWidget(QWidget *parent)
: QWidget(parent)
{
const auto nullTitle = i18nc("NullPIN is a word that is used all over in the netkey "
"documentation and should be understandable by Netkey cardholders",
......
......@@ -47,7 +47,7 @@ class NullPinWidget: public QWidget
{
Q_OBJECT
public:
NullPinWidget();
explicit NullPinWidget(QWidget *parent = nullptr);
void setSigGVisible(bool val);
void setNKSVisible(bool val);
......
......@@ -121,14 +121,15 @@ class GenKeyThread: public QThread
#endif
} // Namespace
PGPCardWidget::PGPCardWidget():
mSerialNumber(new QLabel),
mCardHolderLabel(new QLabel),
mVersionLabel(new QLabel),
mSigningKey(new QLabel),
mEncryptionKey(new QLabel),
mAuthKey(new QLabel),
mUrlLabel(new QLabel),
PGPCardWidget::PGPCardWidget(QWidget *parent):
QWidget(parent),
mSerialNumber(new QLabel(this)),
mCardHolderLabel(new QLabel(this)),
mVersionLabel(new QLabel(this)),
mSigningKey(new QLabel(this)),
mEncryptionKey(new QLabel(this)),
mAuthKey(new QLabel(this)),
mUrlLabel(new QLabel(this)),
mCardIsEmpty(false)
{
auto grid = new QGridLayout;
......
......@@ -52,7 +52,7 @@ class PGPCardWidget: public QWidget
{
Q_OBJECT
public:
PGPCardWidget();
explicit PGPCardWidget(QWidget *parent = nullptr);
void setCard(const SmartCard::OpenPGPCard* card);
void doChangePin(int slot);
......
......@@ -55,7 +55,8 @@ class PlaceHolderWidget: public QWidget
{
Q_OBJECT
public:
PlaceHolderWidget()
explicit PlaceHolderWidget(QWidget *parent = nullptr)
: QWidget(parent)
{
auto lay = new QVBoxLayout;
lay->addStretch(-1);
......@@ -64,14 +65,14 @@ public:
<< QStringLiteral("Gnuk")
<< QStringLiteral("NetKey v3");
lay->addWidget(new QLabel(QStringLiteral("\t\t<h3>") +
i18n("Please insert a compatible smartcard.") + QStringLiteral("</h3>")));
i18n("Please insert a compatible smartcard.") + QStringLiteral("</h3>"), this));
lay->addSpacing(10);
lay->addWidget(new QLabel(QStringLiteral("\t\t") +
i18n("Kleopatra currently supports the following card types:") +
QStringLiteral("<ul><li>") + supported.join(QLatin1String("</li><li>")) +
QStringLiteral("</li></ul>")));
QStringLiteral("</li></ul>"), this));
lay->addSpacing(10);
lay->addWidget(new QLabel(i18n("Refresh the view (F5) to update the smartcard status.")));
lay->addWidget(new QLabel(i18n("Refresh the view (F5) to update the smartcard status."), this));
lay->addStretch(-1);
auto hLay = new QHBoxLayout(this);
......@@ -105,13 +106,13 @@ public:
mStack = new QStackedWidget;
vLay->addWidget(mStack);
mPGPCardWidget = new PGPCardWidget;
mPGPCardWidget = new PGPCardWidget(q);
mStack->addWidget(mPGPCardWidget);
mNetKeyWidget = new NetKeyWidget;
mNetKeyWidget = new NetKeyWidget(q);
mStack->addWidget(mNetKeyWidget);
mPlaceHolderWidget = new PlaceHolderWidget;
mPlaceHolderWidget = new PlaceHolderWidget(q);
mStack->addWidget(mPlaceHolderWidget);
mStack->setCurrentWidget(mPlaceHolderWidget);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment