Fix uninitialized variables

This commit is contained in:
Jonas Kvinge
2021-03-26 21:30:13 +01:00
parent 8a39a43ad5
commit 14fb647647
27 changed files with 64 additions and 65 deletions

View File

@@ -71,7 +71,7 @@ bool LocalRedirectServer::GenerateCertificate() {
return false;
}
gnutls_x509_privkey_t key;
gnutls_x509_privkey_t key = nullptr;
if (int result = gnutls_x509_privkey_init(&key) != GNUTLS_E_SUCCESS) {
error_ = QString("Failed to initialize the private key structure: %1").arg(gnutls_strerror(result));
gnutls_global_deinit();
@@ -104,7 +104,7 @@ bool LocalRedirectServer::GenerateCertificate() {
return false;
}
gnutls_x509_crt_t crt;
gnutls_x509_crt_t crt = nullptr;
if (int result = gnutls_x509_crt_init(&crt) != GNUTLS_E_SUCCESS) {
error_ = QString("Failed to initialize an X.509 certificate structure: %1").arg(gnutls_strerror(result));
gnutls_x509_privkey_deinit(key);
@@ -173,7 +173,7 @@ bool LocalRedirectServer::GenerateCertificate() {
return false;
}
gnutls_privkey_t pkey;
gnutls_privkey_t pkey = nullptr;
if (int result = gnutls_privkey_init(&pkey) != GNUTLS_E_SUCCESS) {
error_ = QString("Failed to initialize a private key object: %1").arg(gnutls_strerror(result));
gnutls_x509_privkey_deinit(key);