diff options
Diffstat (limited to 'runtime/nsd_gtls.c')
-rw-r--r-- | runtime/nsd_gtls.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c index ca4b292..036e829 100644 --- a/runtime/nsd_gtls.c +++ b/runtime/nsd_gtls.c @@ -115,7 +115,7 @@ readFile(uchar *pszFile, gnutls_datum_t *pBuf) pBuf->data = NULL; - if((fd = open((char*)pszFile, 0)) == -1) { + if((fd = open((char*)pszFile, O_RDONLY)) == -1) { errmsg.LogError(0, RS_RET_FILE_NOT_FOUND, "can not read file '%s'", pszFile); ABORT_FINALIZE(RS_RET_FILE_NOT_FOUND); @@ -204,10 +204,14 @@ finalize_it: if(iRet != RS_RET_OK) { if(data.data != NULL) free(data.data); - if(pThis->bOurCertIsInit) + if(pThis->bOurCertIsInit) { gnutls_x509_crt_deinit(pThis->ourCert); - if(pThis->bOurKeyIsInit) + pThis->bOurCertIsInit = 0; + } + if(pThis->bOurKeyIsInit) { gnutls_x509_privkey_deinit(pThis->ourKey); + pThis->bOurKeyIsInit = 0; + } } RETiRet; } |