Skip to content

Commit

Permalink
fix memory leak in cert wizard, null-check, dbgoutput before hard-fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Kissaki committed Apr 13, 2013
1 parent 3c5976d commit e58aa08
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/mumble/Cert.cpp
Expand Up @@ -81,6 +81,13 @@ CertView::CertView(QWidget *p) : QGroupBox(p) {
grid->setColumnStretch(1, 1);
}

CertView::~CertView() {
delete qlSubjectName;
delete qlSubjectEmail;
delete qlIssuerName;
delete qlExpiry;

This comment has been minimized.

Copy link
@hacst

hacst Apr 22, 2013

Contributor

Not sure those are actually leaks. They should be properly parented in the constructor and then cleaned up by Qt.

This comment has been minimized.

Copy link
@Kissaki

Kissaki Apr 22, 2013

Author Member

Opening and closing the cert wizard numerous times increased the mumble.exe processes memory usage.
With these deletes this didn’t seem to be the case any more.

Still, we should check why we get a leak then without these theoretically unnecessary(?) deletes.

}

void CertView::setCert(const QList<QSslCertificate> &cert) {
qlCert = cert;

Expand Down
1 change: 1 addition & 0 deletions src/mumble/Cert.h
Expand Up @@ -50,6 +50,7 @@ class CertView : public QGroupBox {
QLabel *qlSubjectName, *qlSubjectEmail, *qlIssuerName, *qlExpiry;
public:
CertView(QWidget *p);
virtual ~CertView();
void setCert(const QList<QSslCertificate> &cert);
};

Expand Down
10 changes: 6 additions & 4 deletions src/mumble/ConfigDialog.cpp
Expand Up @@ -42,10 +42,12 @@ ConfigDialog::ConfigDialog(QWidget *p) : QDialog(p) {

s = g.s;

unsigned int idx = 0;
ConfigWidgetNew cwn;
foreach(cwn, *ConfigRegistrar::c_qmNew) {
addPage(cwn(s), ++idx);
if (ConfigRegistrar::c_qmNew) {
unsigned int idx = 0;
ConfigWidgetNew cwn;
foreach(cwn, *ConfigRegistrar::c_qmNew) {
addPage(cwn(s), ++idx);
}
}

qcbExpert->setChecked(g.s.bExpert);
Expand Down
1 change: 1 addition & 0 deletions src/murmur/ServerDB.cpp
Expand Up @@ -78,6 +78,7 @@ ServerDB::ServerDB() {
}
if (db) {
// Don’t hide away our previous instance. Fail hard.
OutputDebugStringA("ServerDB has already been instantiated!");

This comment has been minimized.

Copy link
@hacst

hacst Apr 22, 2013

Contributor

This really should be some Qt logging call. Especially since OutputDebugString is a winapi function ;)

(Btw.: My Qt Creator is confused by the fancy apostroph-like-char in "Don't" in the comment above. It's UTF-8 alright but apparently creator defaults to system encoding. We should probably stick to ASCII for our code. A plain old ' shouldn't be a problem)

throw std::exception();
}
db = new QSqlDatabase(QSqlDatabase::addDatabase(Meta::mp.qsDBDriver));
Expand Down

0 comments on commit e58aa08

Please sign in to comment.