/* FIXME-20070101: we should do this too at the end of the
* config parsing to free all default values.
*/
- if (defproxy.check_req) free(defproxy.check_req);
- if (defproxy.cookie_name) free(defproxy.cookie_name);
- if (defproxy.url_param_name) free(defproxy.url_param_name);
- if (defproxy.capture_name) free(defproxy.capture_name);
- if (defproxy.monitor_uri) free(defproxy.monitor_uri);
- if (defproxy.defbe.name) free(defproxy.defbe.name);
+ free(defproxy.check_req);
+ free(defproxy.cookie_name);
+ free(defproxy.url_param_name);
+ free(defproxy.capture_name);
+ free(defproxy.monitor_uri);
+ free(defproxy.defbe.name);
- for (rc = 0; rc < HTTP_ERR_SIZE; rc++) {
- if (defproxy.errmsg[rc].len)
- free(defproxy.errmsg[rc].str);
- }
+ for (rc = 0; rc < HTTP_ERR_SIZE; rc++)
+ free(defproxy.errmsg[rc].str);
/* we cannot free uri_auth because it might already be used */
init_default_instance();
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 = (char *)calloc(1, curproxy->monitor_uri_len + 1);
memcpy(curproxy->monitor_uri, args[1], curproxy->monitor_uri_len);
}
else if (!strcmp(args[0], "cookie")) { /* cookie name */
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))
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) {
Alert("parsing [%s:%d] : '%s' expects <cookie_name> as argument.\n",
file, linenum, args[0]);
return -1;
}
+
+ free(curproxy->cookie_name);
curproxy->cookie_name = strdup(args[1]);
curproxy->cookie_len = strlen(curproxy->cookie_name);
}
}/* end else if (!strcmp(args[0], "cookie")) */
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))
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) {
Alert("parsing [%s:%d] : '%s' expects 'appsession' <cookie_name> 'len' <len> 'timeout' <timeout>.\n",
file, linenum, args[0]);
return -1;
}
have_appsession = 1;
+ free(curproxy->appsession_name);
curproxy->appsession_name = strdup(args[1]);
curproxy->appsession_name_len = strlen(curproxy->appsession_name);
curproxy->appsession_len = atoi(args[3]);
return 0;
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) {
Alert("parsing [%s:%d] : '%s' expects 'cookie' <cookie_name> 'len' <len>.\n",
file, linenum, args[0]);
return -1;
}
+ free(curproxy->capture_name);
curproxy->capture_name = strdup(args[2]);
curproxy->capture_namelen = strlen(curproxy->capture_name);
curproxy->capture_len = atol(args[4]);
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[1], NULL))
return 0;
/* 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_SMTP_CHK;
curproxy->options |= PR_O_HTTP_CHK;
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[1], NULL))
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_SMTP_CHK;
curproxy->options |= PR_O_SSL3_CHK;
}
else if (!strcmp(args[1], "smtpchk")) {
/* 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_SSL3_CHK;
curproxy->options |= PR_O_SMTP_CHK;
Alert("parsing [%s:%d] : '%s' expects a backend name.\n", file, linenum, args[0]);
return -1;
}
- if (curproxy->defbe.name)
- free(curproxy->defbe.name);
+ free(curproxy->defbe.name);
curproxy->defbe.name = strdup(args[1]);
}
else if (!strcmp(args[0], "redispatch") || !strcmp(args[0], "redisp")) {
for (rc = 0; rc < HTTP_ERR_SIZE; rc++) {
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].len = errlen;
break;
errnum = atol(args[1]);
for (rc = 0; rc < HTTP_ERR_SIZE; rc++) {
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].len = errlen;
break;
!strcmp(args[0], "ruleset") ||
!strcmp(args[0], "defaults")) { /* new proxy */
confsect = CFG_LISTEN;
- if (cursection)
- free(cursection);
+ free(cursection);
cursection = strdup(args[0]);
}
else if (!strcmp(args[0], "global")) { /* global config */
confsect = CFG_GLOBAL;
- if (cursection)
- free(cursection);
+ free(cursection);
cursection = strdup(args[0]);
}
/* else it's a section keyword */
goto err;
}
}
- if (cursection)
- free(cursection);
+ free(cursection);
cursection = NULL;
fclose(f);
}
}
- if (cursection)
- free(cursection);
+ free(cursection);
cursection = NULL;
return 0;
err:
- if (cursection)
- free(cursection);
+ free(cursection);
cursection = NULL;
return -1;
}
global.maxconn = cfg_maxconn;
if (cfg_pidfile) {
- if (global.pidfile)
- free(global.pidfile);
+ free(global.pidfile);
global.pidfile = strdup(cfg_pidfile);
}
int i;
while (p) {
- if (p->id)
- free(p->id);
-
- if (p->check_req)
- free(p->check_req);
-
- if (p->cookie_name)
- free(p->cookie_name);
-
- if (p->cookie_domain)
- free(p->cookie_domain);
-
- if (p->url_param_name)
- free(p->url_param_name);
+ 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->capture_name)
- free(p->capture_name);
+ for (i = 0; i < HTTP_ERR_SIZE; i++)
+ free(p->errmsg[i].str);
- 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_reqadd; i++)
+ free(p->req_add[i]);
- for (i = 0; i < p->nb_rspadd; i++) {
- if (p->rsp_add[i])
- free(p->rsp_add[i]);
- }
+ for (i = 0; i < p->nb_rspadd; i++)
+ free(p->rsp_add[i]);
list_for_each_entry_safe(cond, condb, &p->block_cond, list) {
LIST_DEL(&cond->list);
list_for_each_entry_safe(rule, ruleb, &p->switching_rules, list) {
LIST_DEL(&rule->list);
-
prune_acl_cond(rule->cond);
free(rule->cond);
-
free(rule);
}
free(rdr);
}
- if (p->appsession_name)
- free(p->appsession_name);
+ free(p->appsession_name);
h = p->req_cap;
while (h) {
h_next = h->next;
- if (h->name)
- free(h->name);
+ free(h->name);
pool_destroy2(h->pool);
free(h);
h = h_next;
h = p->rsp_cap;
while (h) {
h_next = h->next;
- if (h->name)
- free(h->name);
-
+ free(h->name);
pool_destroy2(h->pool);
free(h);
h = h_next;
task_free(s->check);
}
- if (s->id)
- free(s->id);
-
- if (s->cookie)
- free(s->cookie);
-
+ free(s->id);
+ free(s->cookie);
free(s);
s = s_next;
}/* end while(s) */
uap = ua;
ua = ua->next;
- if (uap->uri_prefix)
- free(uap->uri_prefix);
-
- if (uap->auth_realm)
- free(uap->auth_realm);
+ free(uap->uri_prefix);
+ free(uap->auth_realm);
while (uap->users) {
user = uap->users;
uap->users = uap->users->next;
-
free(user->user_pwd);
free(user);
}
-
free(uap);
}
protocol_unbind_all();
- if (global.chroot) free(global.chroot);
- global.chroot = NULL;
-
- if (global.pidfile) free(global.pidfile);
- global.pidfile = NULL;
-
- if (fdtab) free(fdtab);
- fdtab = NULL;
-
- if (oldpids)
- free(oldpids);
+ free(global.chroot); global.chroot = NULL;
+ free(global.pidfile); global.pidfile = NULL;
+ free(fdtab); fdtab = NULL;
+ free(oldpids); oldpids = NULL;
pool_destroy2(pool2_session);
pool_destroy2(pool2_buffer);