mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
[CLEANUP] remove 65 useless NULL checks before free
C specification clearly states that free(NULL) is a no-op. So remove useless checks before calling free.
This commit is contained in:
parent
af72a1d8ec
commit
a534fea478
@ -2078,10 +2078,10 @@ int backend_parse_balance(const char **args, char *err, int errlen, struct proxy
|
|||||||
}
|
}
|
||||||
curproxy->lbprm.algo &= ~BE_LB_ALGO;
|
curproxy->lbprm.algo &= ~BE_LB_ALGO;
|
||||||
curproxy->lbprm.algo |= BE_LB_ALGO_PH;
|
curproxy->lbprm.algo |= BE_LB_ALGO_PH;
|
||||||
if (curproxy->url_param_name)
|
|
||||||
free(curproxy->url_param_name);
|
free(curproxy->url_param_name);
|
||||||
curproxy->url_param_name = strdup(args[1]);
|
curproxy->url_param_name = strdup(args[1]);
|
||||||
curproxy->url_param_len = strlen(args[1]);
|
curproxy->url_param_len = strlen(args[1]);
|
||||||
if (*args[2]) {
|
if (*args[2]) {
|
||||||
if (strcmp(args[2], "check_post")) {
|
if (strcmp(args[2], "check_post")) {
|
||||||
snprintf(err, errlen, "'balance url_param' only accepts check_post modifier.");
|
snprintf(err, errlen, "'balance url_param' only accepts check_post modifier.");
|
||||||
|
@ -715,17 +715,15 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
|
|||||||
/* FIXME-20070101: we should do this too at the end of the
|
/* FIXME-20070101: we should do this too at the end of the
|
||||||
* config parsing to free all default values.
|
* config parsing to free all default values.
|
||||||
*/
|
*/
|
||||||
if (defproxy.check_req) free(defproxy.check_req);
|
free(defproxy.check_req);
|
||||||
if (defproxy.cookie_name) free(defproxy.cookie_name);
|
free(defproxy.cookie_name);
|
||||||
if (defproxy.url_param_name) free(defproxy.url_param_name);
|
free(defproxy.url_param_name);
|
||||||
if (defproxy.capture_name) free(defproxy.capture_name);
|
free(defproxy.capture_name);
|
||||||
if (defproxy.monitor_uri) free(defproxy.monitor_uri);
|
free(defproxy.monitor_uri);
|
||||||
if (defproxy.defbe.name) free(defproxy.defbe.name);
|
free(defproxy.defbe.name);
|
||||||
|
|
||||||
for (rc = 0; rc < HTTP_ERR_SIZE; rc++) {
|
for (rc = 0; rc < HTTP_ERR_SIZE; rc++)
|
||||||
if (defproxy.errmsg[rc].len)
|
free(defproxy.errmsg[rc].str);
|
||||||
free(defproxy.errmsg[rc].str);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* we cannot free uri_auth because it might already be used */
|
/* we cannot free uri_auth because it might already be used */
|
||||||
init_default_instance();
|
init_default_instance();
|
||||||
@ -804,9 +802,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curproxy->monitor_uri != NULL)
|
free(curproxy->monitor_uri);
|
||||||
free(curproxy->monitor_uri);
|
|
||||||
|
|
||||||
curproxy->monitor_uri_len = strlen(args[1]);
|
curproxy->monitor_uri_len = strlen(args[1]);
|
||||||
curproxy->monitor_uri = (char *)calloc(1, curproxy->monitor_uri_len + 1);
|
curproxy->monitor_uri = (char *)calloc(1, curproxy->monitor_uri_len + 1);
|
||||||
memcpy(curproxy->monitor_uri, args[1], curproxy->monitor_uri_len);
|
memcpy(curproxy->monitor_uri, args[1], curproxy->monitor_uri_len);
|
||||||
@ -875,26 +871,17 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
|
|||||||
}
|
}
|
||||||
else if (!strcmp(args[0], "cookie")) { /* cookie name */
|
else if (!strcmp(args[0], "cookie")) { /* cookie name */
|
||||||
int cur_arg;
|
int cur_arg;
|
||||||
// if (curproxy == &defproxy) {
|
|
||||||
// Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
|
|
||||||
// return -1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL))
|
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (curproxy->cookie_name != NULL) {
|
|
||||||
// Alert("parsing [%s:%d] : cookie name already specified. Continuing.\n",
|
|
||||||
// file, linenum);
|
|
||||||
// return 0;
|
|
||||||
free(curproxy->cookie_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*(args[1]) == 0) {
|
if (*(args[1]) == 0) {
|
||||||
Alert("parsing [%s:%d] : '%s' expects <cookie_name> as argument.\n",
|
Alert("parsing [%s:%d] : '%s' expects <cookie_name> as argument.\n",
|
||||||
file, linenum, args[0]);
|
file, linenum, args[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(curproxy->cookie_name);
|
||||||
curproxy->cookie_name = strdup(args[1]);
|
curproxy->cookie_name = strdup(args[1]);
|
||||||
curproxy->cookie_len = strlen(curproxy->cookie_name);
|
curproxy->cookie_len = strlen(curproxy->cookie_name);
|
||||||
|
|
||||||
@ -963,27 +950,17 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
|
|||||||
}
|
}
|
||||||
}/* end else if (!strcmp(args[0], "cookie")) */
|
}/* end else if (!strcmp(args[0], "cookie")) */
|
||||||
else if (!strcmp(args[0], "appsession")) { /* cookie name */
|
else if (!strcmp(args[0], "appsession")) { /* cookie name */
|
||||||
// if (curproxy == &defproxy) {
|
|
||||||
// Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
|
|
||||||
// return -1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL))
|
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (curproxy->appsession_name != NULL) {
|
|
||||||
// Alert("parsing [%s:%d] : cookie name already specified. Continuing.\n",
|
|
||||||
// file, linenum);
|
|
||||||
// return 0;
|
|
||||||
free(curproxy->appsession_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*(args[5]) == 0) {
|
if (*(args[5]) == 0) {
|
||||||
Alert("parsing [%s:%d] : '%s' expects 'appsession' <cookie_name> 'len' <len> 'timeout' <timeout>.\n",
|
Alert("parsing [%s:%d] : '%s' expects 'appsession' <cookie_name> 'len' <len> 'timeout' <timeout>.\n",
|
||||||
file, linenum, args[0]);
|
file, linenum, args[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
have_appsession = 1;
|
have_appsession = 1;
|
||||||
|
free(curproxy->appsession_name);
|
||||||
curproxy->appsession_name = strdup(args[1]);
|
curproxy->appsession_name = strdup(args[1]);
|
||||||
curproxy->appsession_name_len = strlen(curproxy->appsession_name);
|
curproxy->appsession_name_len = strlen(curproxy->appsession_name);
|
||||||
curproxy->appsession_len = atoi(args[3]);
|
curproxy->appsession_len = atoi(args[3]);
|
||||||
@ -1005,23 +982,12 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!strcmp(args[1], "cookie")) { /* name of a cookie to capture */
|
if (!strcmp(args[1], "cookie")) { /* name of a cookie to capture */
|
||||||
// if (curproxy == &defproxy) {
|
|
||||||
// Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
|
|
||||||
// return -1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (curproxy->capture_name != NULL) {
|
|
||||||
// Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n",
|
|
||||||
// file, linenum, args[0]);
|
|
||||||
// return 0;
|
|
||||||
free(curproxy->capture_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*(args[4]) == 0) {
|
if (*(args[4]) == 0) {
|
||||||
Alert("parsing [%s:%d] : '%s' expects 'cookie' <cookie_name> 'len' <len>.\n",
|
Alert("parsing [%s:%d] : '%s' expects 'cookie' <cookie_name> 'len' <len>.\n",
|
||||||
file, linenum, args[0]);
|
file, linenum, args[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
free(curproxy->capture_name);
|
||||||
curproxy->capture_name = strdup(args[2]);
|
curproxy->capture_name = strdup(args[2]);
|
||||||
curproxy->capture_namelen = strlen(curproxy->capture_name);
|
curproxy->capture_namelen = strlen(curproxy->capture_name);
|
||||||
curproxy->capture_len = atol(args[4]);
|
curproxy->capture_len = atol(args[4]);
|
||||||
@ -1378,9 +1344,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
|
|||||||
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[1], NULL))
|
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[1], NULL))
|
||||||
return 0;
|
return 0;
|
||||||
/* use HTTP request to check servers' health */
|
/* use HTTP request to check servers' health */
|
||||||
if (curproxy->check_req != NULL) {
|
free(curproxy->check_req);
|
||||||
free(curproxy->check_req);
|
|
||||||
}
|
|
||||||
curproxy->options &= ~PR_O_SSL3_CHK;
|
curproxy->options &= ~PR_O_SSL3_CHK;
|
||||||
curproxy->options &= ~PR_O_SMTP_CHK;
|
curproxy->options &= ~PR_O_SMTP_CHK;
|
||||||
curproxy->options |= PR_O_HTTP_CHK;
|
curproxy->options |= PR_O_HTTP_CHK;
|
||||||
@ -1409,18 +1373,14 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
|
|||||||
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[1], NULL))
|
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[1], NULL))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (curproxy->check_req != NULL) {
|
free(curproxy->check_req);
|
||||||
free(curproxy->check_req);
|
|
||||||
}
|
|
||||||
curproxy->options &= ~PR_O_HTTP_CHK;
|
curproxy->options &= ~PR_O_HTTP_CHK;
|
||||||
curproxy->options &= ~PR_O_SMTP_CHK;
|
curproxy->options &= ~PR_O_SMTP_CHK;
|
||||||
curproxy->options |= PR_O_SSL3_CHK;
|
curproxy->options |= PR_O_SSL3_CHK;
|
||||||
}
|
}
|
||||||
else if (!strcmp(args[1], "smtpchk")) {
|
else if (!strcmp(args[1], "smtpchk")) {
|
||||||
/* use SMTP request to check servers' health */
|
/* use SMTP request to check servers' health */
|
||||||
if (curproxy->check_req != NULL) {
|
free(curproxy->check_req);
|
||||||
free(curproxy->check_req);
|
|
||||||
}
|
|
||||||
curproxy->options &= ~PR_O_HTTP_CHK;
|
curproxy->options &= ~PR_O_HTTP_CHK;
|
||||||
curproxy->options &= ~PR_O_SSL3_CHK;
|
curproxy->options &= ~PR_O_SSL3_CHK;
|
||||||
curproxy->options |= PR_O_SMTP_CHK;
|
curproxy->options |= PR_O_SMTP_CHK;
|
||||||
@ -1501,8 +1461,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
|
|||||||
Alert("parsing [%s:%d] : '%s' expects a backend name.\n", file, linenum, args[0]);
|
Alert("parsing [%s:%d] : '%s' expects a backend name.\n", file, linenum, args[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (curproxy->defbe.name)
|
free(curproxy->defbe.name);
|
||||||
free(curproxy->defbe.name);
|
|
||||||
curproxy->defbe.name = strdup(args[1]);
|
curproxy->defbe.name = strdup(args[1]);
|
||||||
}
|
}
|
||||||
else if (!strcmp(args[0], "redispatch") || !strcmp(args[0], "redisp")) {
|
else if (!strcmp(args[0], "redispatch") || !strcmp(args[0], "redisp")) {
|
||||||
@ -2617,8 +2576,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
|
|||||||
|
|
||||||
for (rc = 0; rc < HTTP_ERR_SIZE; rc++) {
|
for (rc = 0; rc < HTTP_ERR_SIZE; rc++) {
|
||||||
if (http_err_codes[rc] == errnum) {
|
if (http_err_codes[rc] == errnum) {
|
||||||
if (curproxy->errmsg[rc].str)
|
free(curproxy->errmsg[rc].str);
|
||||||
free(curproxy->errmsg[rc].str);
|
|
||||||
curproxy->errmsg[rc].str = err;
|
curproxy->errmsg[rc].str = err;
|
||||||
curproxy->errmsg[rc].len = errlen;
|
curproxy->errmsg[rc].len = errlen;
|
||||||
break;
|
break;
|
||||||
@ -2675,8 +2633,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
|
|||||||
errnum = atol(args[1]);
|
errnum = atol(args[1]);
|
||||||
for (rc = 0; rc < HTTP_ERR_SIZE; rc++) {
|
for (rc = 0; rc < HTTP_ERR_SIZE; rc++) {
|
||||||
if (http_err_codes[rc] == errnum) {
|
if (http_err_codes[rc] == errnum) {
|
||||||
if (curproxy->errmsg[rc].str)
|
free(curproxy->errmsg[rc].str);
|
||||||
free(curproxy->errmsg[rc].str);
|
|
||||||
curproxy->errmsg[rc].str = err;
|
curproxy->errmsg[rc].str = err;
|
||||||
curproxy->errmsg[rc].len = errlen;
|
curproxy->errmsg[rc].len = errlen;
|
||||||
break;
|
break;
|
||||||
@ -2856,14 +2813,12 @@ int readcfgfile(const char *file)
|
|||||||
!strcmp(args[0], "ruleset") ||
|
!strcmp(args[0], "ruleset") ||
|
||||||
!strcmp(args[0], "defaults")) { /* new proxy */
|
!strcmp(args[0], "defaults")) { /* new proxy */
|
||||||
confsect = CFG_LISTEN;
|
confsect = CFG_LISTEN;
|
||||||
if (cursection)
|
free(cursection);
|
||||||
free(cursection);
|
|
||||||
cursection = strdup(args[0]);
|
cursection = strdup(args[0]);
|
||||||
}
|
}
|
||||||
else if (!strcmp(args[0], "global")) { /* global config */
|
else if (!strcmp(args[0], "global")) { /* global config */
|
||||||
confsect = CFG_GLOBAL;
|
confsect = CFG_GLOBAL;
|
||||||
if (cursection)
|
free(cursection);
|
||||||
free(cursection);
|
|
||||||
cursection = strdup(args[0]);
|
cursection = strdup(args[0]);
|
||||||
}
|
}
|
||||||
/* else it's a section keyword */
|
/* else it's a section keyword */
|
||||||
@ -2882,8 +2837,7 @@ int readcfgfile(const char *file)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cursection)
|
free(cursection);
|
||||||
free(cursection);
|
|
||||||
cursection = NULL;
|
cursection = NULL;
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
@ -3284,14 +3238,12 @@ int readcfgfile(const char *file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursection)
|
free(cursection);
|
||||||
free(cursection);
|
|
||||||
cursection = NULL;
|
cursection = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (cursection)
|
free(cursection);
|
||||||
free(cursection);
|
|
||||||
cursection = NULL;
|
cursection = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -325,14 +325,10 @@ REGPRM1 static void _do_term(struct poller *p)
|
|||||||
{
|
{
|
||||||
fd_flush_changes();
|
fd_flush_changes();
|
||||||
|
|
||||||
if (chg_ptr)
|
free(chg_ptr);
|
||||||
free(chg_ptr);
|
free(chg_list);
|
||||||
if (chg_list)
|
free(fd_evts);
|
||||||
free(chg_list);
|
free(epoll_events);
|
||||||
if (fd_evts)
|
|
||||||
free(fd_evts);
|
|
||||||
if (epoll_events)
|
|
||||||
free(epoll_events);
|
|
||||||
|
|
||||||
close(epoll_fd);
|
close(epoll_fd);
|
||||||
epoll_fd = 0;
|
epoll_fd = 0;
|
||||||
|
@ -199,12 +199,9 @@ REGPRM1 static int _do_init(struct poller *p)
|
|||||||
*/
|
*/
|
||||||
REGPRM1 static void _do_term(struct poller *p)
|
REGPRM1 static void _do_term(struct poller *p)
|
||||||
{
|
{
|
||||||
if (fd_evts[DIR_WR])
|
free(fd_evts[DIR_WR]);
|
||||||
free(fd_evts[DIR_WR]);
|
free(fd_evts[DIR_RD]);
|
||||||
if (fd_evts[DIR_RD])
|
free(kev);
|
||||||
free(fd_evts[DIR_RD]);
|
|
||||||
if (kev)
|
|
||||||
free(kev);
|
|
||||||
close(kqueue_fd);
|
close(kqueue_fd);
|
||||||
kqueue_fd = 0;
|
kqueue_fd = 0;
|
||||||
|
|
||||||
|
@ -207,12 +207,9 @@ REGPRM1 static int _do_init(struct poller *p)
|
|||||||
*/
|
*/
|
||||||
REGPRM1 static void _do_term(struct poller *p)
|
REGPRM1 static void _do_term(struct poller *p)
|
||||||
{
|
{
|
||||||
if (fd_evts[DIR_WR])
|
free(fd_evts[DIR_WR]);
|
||||||
free(fd_evts[DIR_WR]);
|
free(fd_evts[DIR_RD]);
|
||||||
if (fd_evts[DIR_RD])
|
free(poll_events);
|
||||||
free(fd_evts[DIR_RD]);
|
|
||||||
if (poll_events)
|
|
||||||
free(poll_events);
|
|
||||||
p->private = NULL;
|
p->private = NULL;
|
||||||
p->pref = 0;
|
p->pref = 0;
|
||||||
}
|
}
|
||||||
|
@ -202,14 +202,10 @@ REGPRM1 static int _do_init(struct poller *p)
|
|||||||
*/
|
*/
|
||||||
REGPRM1 static void _do_term(struct poller *p)
|
REGPRM1 static void _do_term(struct poller *p)
|
||||||
{
|
{
|
||||||
if (fd_evts[DIR_WR])
|
free(fd_evts[DIR_WR]);
|
||||||
free(fd_evts[DIR_WR]);
|
free(fd_evts[DIR_RD]);
|
||||||
if (fd_evts[DIR_RD])
|
free(tmp_evts[DIR_WR]);
|
||||||
free(fd_evts[DIR_RD]);
|
free(tmp_evts[DIR_RD]);
|
||||||
if (tmp_evts[DIR_WR])
|
|
||||||
free(tmp_evts[DIR_WR]);
|
|
||||||
if (tmp_evts[DIR_RD])
|
|
||||||
free(tmp_evts[DIR_RD]);
|
|
||||||
p->private = NULL;
|
p->private = NULL;
|
||||||
p->pref = 0;
|
p->pref = 0;
|
||||||
}
|
}
|
||||||
|
@ -541,12 +541,9 @@ REGPRM1 static int _do_init(struct poller *p)
|
|||||||
*/
|
*/
|
||||||
REGPRM1 static void _do_term(struct poller *p)
|
REGPRM1 static void _do_term(struct poller *p)
|
||||||
{
|
{
|
||||||
if (fd_list)
|
free(fd_list);
|
||||||
free(fd_list);
|
free(spec_list);
|
||||||
if (spec_list)
|
free(epoll_events);
|
||||||
free(spec_list);
|
|
||||||
if (epoll_events)
|
|
||||||
free(epoll_events);
|
|
||||||
|
|
||||||
close(epoll_fd);
|
close(epoll_fd);
|
||||||
epoll_fd = 0;
|
epoll_fd = 0;
|
||||||
|
@ -547,8 +547,7 @@ void init(int argc, char **argv)
|
|||||||
global.maxconn = cfg_maxconn;
|
global.maxconn = cfg_maxconn;
|
||||||
|
|
||||||
if (cfg_pidfile) {
|
if (cfg_pidfile) {
|
||||||
if (global.pidfile)
|
free(global.pidfile);
|
||||||
free(global.pidfile);
|
|
||||||
global.pidfile = strdup(cfg_pidfile);
|
global.pidfile = strdup(cfg_pidfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,41 +644,22 @@ void deinit(void)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
while (p) {
|
while (p) {
|
||||||
if (p->id)
|
free(p->id);
|
||||||
free(p->id);
|
free(p->check_req);
|
||||||
|
free(p->cookie_name);
|
||||||
|
free(p->cookie_domain);
|
||||||
|
free(p->url_param_name);
|
||||||
|
free(p->capture_name);
|
||||||
|
free(p->monitor_uri);
|
||||||
|
|
||||||
if (p->check_req)
|
for (i = 0; i < HTTP_ERR_SIZE; i++)
|
||||||
free(p->check_req);
|
free(p->errmsg[i].str);
|
||||||
|
|
||||||
if (p->cookie_name)
|
for (i = 0; i < p->nb_reqadd; i++)
|
||||||
free(p->cookie_name);
|
free(p->req_add[i]);
|
||||||
|
|
||||||
if (p->cookie_domain)
|
for (i = 0; i < p->nb_rspadd; i++)
|
||||||
free(p->cookie_domain);
|
free(p->rsp_add[i]);
|
||||||
|
|
||||||
if (p->url_param_name)
|
|
||||||
free(p->url_param_name);
|
|
||||||
|
|
||||||
if (p->capture_name)
|
|
||||||
free(p->capture_name);
|
|
||||||
|
|
||||||
if (p->monitor_uri)
|
|
||||||
free(p->monitor_uri);
|
|
||||||
|
|
||||||
for (i = 0; i < HTTP_ERR_SIZE; i++) {
|
|
||||||
if (p->errmsg[i].len)
|
|
||||||
free(p->errmsg[i].str);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < p->nb_reqadd; i++) {
|
|
||||||
if (p->req_add[i])
|
|
||||||
free(p->req_add[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < p->nb_rspadd; i++) {
|
|
||||||
if (p->rsp_add[i])
|
|
||||||
free(p->rsp_add[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
list_for_each_entry_safe(cond, condb, &p->block_cond, list) {
|
list_for_each_entry_safe(cond, condb, &p->block_cond, list) {
|
||||||
LIST_DEL(&cond->list);
|
LIST_DEL(&cond->list);
|
||||||
@ -743,10 +723,8 @@ void deinit(void)
|
|||||||
|
|
||||||
list_for_each_entry_safe(rule, ruleb, &p->switching_rules, list) {
|
list_for_each_entry_safe(rule, ruleb, &p->switching_rules, list) {
|
||||||
LIST_DEL(&rule->list);
|
LIST_DEL(&rule->list);
|
||||||
|
|
||||||
prune_acl_cond(rule->cond);
|
prune_acl_cond(rule->cond);
|
||||||
free(rule->cond);
|
free(rule->cond);
|
||||||
|
|
||||||
free(rule);
|
free(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -758,14 +736,12 @@ void deinit(void)
|
|||||||
free(rdr);
|
free(rdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->appsession_name)
|
free(p->appsession_name);
|
||||||
free(p->appsession_name);
|
|
||||||
|
|
||||||
h = p->req_cap;
|
h = p->req_cap;
|
||||||
while (h) {
|
while (h) {
|
||||||
h_next = h->next;
|
h_next = h->next;
|
||||||
if (h->name)
|
free(h->name);
|
||||||
free(h->name);
|
|
||||||
pool_destroy2(h->pool);
|
pool_destroy2(h->pool);
|
||||||
free(h);
|
free(h);
|
||||||
h = h_next;
|
h = h_next;
|
||||||
@ -774,9 +750,7 @@ void deinit(void)
|
|||||||
h = p->rsp_cap;
|
h = p->rsp_cap;
|
||||||
while (h) {
|
while (h) {
|
||||||
h_next = h->next;
|
h_next = h->next;
|
||||||
if (h->name)
|
free(h->name);
|
||||||
free(h->name);
|
|
||||||
|
|
||||||
pool_destroy2(h->pool);
|
pool_destroy2(h->pool);
|
||||||
free(h);
|
free(h);
|
||||||
h = h_next;
|
h = h_next;
|
||||||
@ -791,12 +765,8 @@ void deinit(void)
|
|||||||
task_free(s->check);
|
task_free(s->check);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->id)
|
free(s->id);
|
||||||
free(s->id);
|
free(s->cookie);
|
||||||
|
|
||||||
if (s->cookie)
|
|
||||||
free(s->cookie);
|
|
||||||
|
|
||||||
free(s);
|
free(s);
|
||||||
s = s_next;
|
s = s_next;
|
||||||
}/* end while(s) */
|
}/* end while(s) */
|
||||||
@ -820,36 +790,24 @@ void deinit(void)
|
|||||||
uap = ua;
|
uap = ua;
|
||||||
ua = ua->next;
|
ua = ua->next;
|
||||||
|
|
||||||
if (uap->uri_prefix)
|
free(uap->uri_prefix);
|
||||||
free(uap->uri_prefix);
|
free(uap->auth_realm);
|
||||||
|
|
||||||
if (uap->auth_realm)
|
|
||||||
free(uap->auth_realm);
|
|
||||||
|
|
||||||
while (uap->users) {
|
while (uap->users) {
|
||||||
user = uap->users;
|
user = uap->users;
|
||||||
uap->users = uap->users->next;
|
uap->users = uap->users->next;
|
||||||
|
|
||||||
free(user->user_pwd);
|
free(user->user_pwd);
|
||||||
free(user);
|
free(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(uap);
|
free(uap);
|
||||||
}
|
}
|
||||||
|
|
||||||
protocol_unbind_all();
|
protocol_unbind_all();
|
||||||
|
|
||||||
if (global.chroot) free(global.chroot);
|
free(global.chroot); global.chroot = NULL;
|
||||||
global.chroot = NULL;
|
free(global.pidfile); global.pidfile = NULL;
|
||||||
|
free(fdtab); fdtab = NULL;
|
||||||
if (global.pidfile) free(global.pidfile);
|
free(oldpids); oldpids = NULL;
|
||||||
global.pidfile = NULL;
|
|
||||||
|
|
||||||
if (fdtab) free(fdtab);
|
|
||||||
fdtab = NULL;
|
|
||||||
|
|
||||||
if (oldpids)
|
|
||||||
free(oldpids);
|
|
||||||
|
|
||||||
pool_destroy2(pool2_session);
|
pool_destroy2(pool2_session);
|
||||||
pool_destroy2(pool2_buffer);
|
pool_destroy2(pool2_buffer);
|
||||||
|
@ -73,11 +73,9 @@ struct uri_auth *stats_set_uri(struct uri_auth **root, char *uri)
|
|||||||
if ((u = stats_check_init_uri_auth(root)) == NULL)
|
if ((u = stats_check_init_uri_auth(root)) == NULL)
|
||||||
goto out_u;
|
goto out_u;
|
||||||
|
|
||||||
if (u->uri_prefix)
|
free(u->uri_prefix);
|
||||||
free(u->uri_prefix);
|
|
||||||
|
|
||||||
u->uri_len = uri_len;
|
|
||||||
u->uri_prefix = uri_copy;
|
u->uri_prefix = uri_copy;
|
||||||
|
u->uri_len = uri_len;
|
||||||
return u;
|
return u;
|
||||||
|
|
||||||
out_u:
|
out_u:
|
||||||
@ -101,9 +99,7 @@ struct uri_auth *stats_set_realm(struct uri_auth **root, char *realm)
|
|||||||
if ((u = stats_check_init_uri_auth(root)) == NULL)
|
if ((u = stats_check_init_uri_auth(root)) == NULL)
|
||||||
goto out_u;
|
goto out_u;
|
||||||
|
|
||||||
if (u->auth_realm)
|
free(u->auth_realm);
|
||||||
free(u->auth_realm);
|
|
||||||
|
|
||||||
u->auth_realm = realm_copy;
|
u->auth_realm = realm_copy;
|
||||||
return u;
|
return u;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user