Skip to content

Commit

Permalink
Netstreamdriver: deallocate certificate related resources
Browse files Browse the repository at this point in the history
Free resources when a certificate path has been typed in
incorrectly. It will also trigger more information on the
configuration problem.
  • Loading branch information
Cropi committed Oct 30, 2023
1 parent a6da0b0 commit 7e30408
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions runtime/glbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,14 @@ setDfltNetstrmDrvrCAF(void __attribute__((unused)) *pVal, uchar *pNewVal) {
DEFiRet;
FILE *fp;
free(loadConf->globals.pszDfltNetstrmDrvrCAF);
loadConf->globals.pszDfltNetstrmDrvrCAF = pNewVal;
fp = fopen((const char*)pNewVal, "r");
if(fp == NULL) {
LogError(errno, RS_RET_NO_FILE_ACCESS,
"error: defaultnetstreamdrivercafile file '%s' "
"could not be accessed", pNewVal);
} else {
fclose(fp);
loadConf->globals.pszDfltNetstrmDrvrCAF = pNewVal;
}

RETiRet;
Expand Down Expand Up @@ -458,14 +458,14 @@ setDfltNetstrmDrvrCRLF(void __attribute__((unused)) *pVal, uchar *pNewVal) {
DEFiRet;
FILE *fp;
free(loadConf->globals.pszDfltNetstrmDrvrCRLF);
loadConf->globals.pszDfltNetstrmDrvrCRLF = pNewVal;
fp = fopen((const char*)pNewVal, "r");
if(fp == NULL) {
LogError(errno, RS_RET_NO_FILE_ACCESS,
"error: defaultnetstreamdrivercrlfile file '%s' "
"could not be accessed", pNewVal);
} else {
fclose(fp);
loadConf->globals.pszDfltNetstrmDrvrCRLF = pNewVal;
}

RETiRet;
Expand All @@ -478,14 +478,14 @@ setDfltNetstrmDrvrCertFile(void __attribute__((unused)) *pVal, uchar *pNewVal) {
FILE *fp;

free(loadConf->globals.pszDfltNetstrmDrvrCertFile);
loadConf->globals.pszDfltNetstrmDrvrCertFile = pNewVal;
fp = fopen((const char*)pNewVal, "r");
if(fp == NULL) {
LogError(errno, RS_RET_NO_FILE_ACCESS,
"error: defaultnetstreamdrivercertfile '%s' "
"could not be accessed", pNewVal);
} else {
fclose(fp);
loadConf->globals.pszDfltNetstrmDrvrCertFile = pNewVal;
}

RETiRet;
Expand All @@ -497,14 +497,14 @@ setDfltNetstrmDrvrKeyFile(void __attribute__((unused)) *pVal, uchar *pNewVal) {
FILE *fp;

free(loadConf->globals.pszDfltNetstrmDrvrKeyFile);
loadConf->globals.pszDfltNetstrmDrvrKeyFile = pNewVal;
fp = fopen((const char*)pNewVal, "r");
if(fp == NULL) {
LogError(errno, RS_RET_NO_FILE_ACCESS,
"error: defaultnetstreamdriverkeyfile '%s' "
"could not be accessed", pNewVal);
} else {
fclose(fp);
loadConf->globals.pszDfltNetstrmDrvrKeyFile = pNewVal;
}

RETiRet;
Expand Down

0 comments on commit 7e30408

Please sign in to comment.