fix confparser leaks reported by scan-build, add scan script
This commit is contained in:
@@ -118,7 +118,7 @@ void confexport(void)
|
||||
conf.rmps.client_poolsize
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
static int fopen_and_mkdir(const char *dir)
|
||||
{
|
||||
char tmp[256];
|
||||
@@ -154,7 +154,7 @@ static int fopen_and_mkdir(const char *dir)
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
static int test_conf_perms(char *config)
|
||||
{
|
||||
@@ -167,22 +167,26 @@ static int test_conf_perms(char *config)
|
||||
if (errno == ENOENT) {
|
||||
enumtostr(confresult, CONF_MISSING);
|
||||
log(ERROR, confresult, config);
|
||||
free(config_copy);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (!S_ISREG(s.st_mode)) {
|
||||
enumtostr(confresult, CONF_NOTFILE);
|
||||
log(ERROR, confresult, config);
|
||||
//free(config_copy);
|
||||
return 1;
|
||||
}
|
||||
if (!(0400 & s.st_mode)) {
|
||||
enumtostr(confresult, CONF_PERM);
|
||||
log(ERROR, confresult, config);
|
||||
free(config_copy);
|
||||
return 1;
|
||||
}
|
||||
if (access(config, R_OK) != 0) {
|
||||
enumtostr(confresult, CONF_NOT_READABLE);
|
||||
log(ERROR, confresult, config);
|
||||
free(config_copy);
|
||||
return 1;
|
||||
}
|
||||
if (s.st_uid != 0) {
|
||||
@@ -204,18 +208,21 @@ static int test_conf_perms(char *config)
|
||||
if (errno == ENOENT) {
|
||||
enumtostr(confresult, CONF_DIR_MISSING);
|
||||
log(ERROR, confresult, config_copy);
|
||||
free(config_copy);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (!S_ISDIR(s.st_mode)) {
|
||||
enumtostr(confresult, CONF_DIR_NOTDIR);
|
||||
log(ERROR, confresult, config_copy);
|
||||
free(config_copy);
|
||||
return 1;
|
||||
}
|
||||
if (!(0400 & s.st_mode) ||
|
||||
!(0100 & s.st_mode)) {
|
||||
enumtostr(confresult, CONF_DIR_PERM);
|
||||
log(ERROR, confresult, config_copy);
|
||||
free(config_copy);
|
||||
return 1;
|
||||
}
|
||||
if (s.st_uid != 0) {
|
||||
@@ -230,6 +237,7 @@ static int test_conf_perms(char *config)
|
||||
log(WARNING, confresult, config_copy);
|
||||
}
|
||||
}
|
||||
free(config_copy);
|
||||
|
||||
return 0; /* conf is readable */
|
||||
}
|
||||
|
||||
@@ -68,9 +68,10 @@ int add_msg_to_queue(int id, struct msg_t buf)
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
void create_job(struct msg_t buf)
|
||||
{
|
||||
// add_job_in_db();
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user