Merge "Fix resource leak issues, file not close case"

This commit is contained in:
Zuul 2018-10-23 18:45:01 +00:00 committed by Gerrit Code Review
commit ebb9dae417
2 changed files with 3 additions and 2 deletions

View File

@ -784,6 +784,7 @@ string get_shadow_signature ( char * shadowfile , const char * username,
int ret = snprintf(shadowinfo, infolen, "%s", shadowEntry);
if (ret >= (int)infolen)
{
fclose(file_ptr);
elog("insufficient space in shadow buffer(%d) for %d bytes\n",
(int)infolen, ret);
return ( "" );

View File

@ -328,8 +328,8 @@ int add_rmon_client ( const char * process_name_ptr, int port , const char * reg
fprintf(pFile, "%s\n", rmon.rmon_rx_buf);
// release write lock
flock(fileno(pFile), LOCK_UN);
fclose(pFile);
}
fclose(pFile);
}
else
{
@ -442,8 +442,8 @@ int remove_rmon_client( const char * process_name_ptr, int socket )
fprintf(pFile, "%s\n", rmon.rmon_rx_buf);
// release the lock
flock(fileno(pFile), LOCK_UN);
fclose(pFile);
}
fclose(pFile);
} else {
syslog (LOG_ERR, "Failed to open '%s'\n",
RMON_API_DEREG_DIR );