Merge "Fix resource leak issues, file not close case"
This commit is contained in:
commit
ebb9dae417
@ -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 ( "" );
|
||||
|
@ -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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user