diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2016-02-21 15:40:59 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2016-02-21 15:40:59 +0200 |
commit | 722533c595a0976e50cca45dca7f28ff7e599970 (patch) | |
tree | 6534bb0f16d74e75237497f3838034ffe7c84509 /src | |
parent | 599a468169078449b68e7c0ef711c14fb746f0ea (diff) | |
download | pies-722533c595a0976e50cca45dca7f28ff7e599970.tar.gz pies-722533c595a0976e50cca45dca7f28ff7e599970.tar.bz2 |
Fix memory leaks when reconfiguring
* grecs: Upgrade.
* src/acl.c (_acl_common_section_parser): Free old value.
* src/pies.c: Mark statically initialized keywords with
GRECS_CONST.
Diffstat (limited to 'src')
-rw-r--r-- | src/acl.c | 5 | ||||
-rw-r--r-- | src/pies.c | 16 |
2 files changed, 12 insertions, 9 deletions
@@ -526,25 +526,28 @@ _acl_common_section_parser (enum grecs_callback_command cmd, tag = value->v.string; } } else if (flag == ACL_TAG_REQUIRED) { grecs_error (locus, 0, _("missing ACL name")); return 1; } acl = pies_acl_create (tag, locus); if (tag && (acl = pies_acl_install (acl)) == NULL) return 1; if (pacl) - *pacl = acl; + { + pies_acl_free (*pacl); + *pacl = acl; + } break; case grecs_callback_section_end: acl = *pacl; if (acl->list) acl->list->cmp = acl_entry_cmp; break; case grecs_callback_set_value: break; } return 0; @@ -1285,25 +1285,25 @@ struct grecs_keyword control_keywords[] = { &control.usr_acl, 0, acl_section_parser, NULL, acl_keywords}, {"idle-timeout", "n", N_("Disconnect after <n> seconds of inaction (not implemented)."), grecs_type_uint, GRECS_DFLT, &control.idle_timeout, 0, NULL, }, {"realm", N_("name"), N_("Authentication realm name"), - grecs_type_string, GRECS_DFLT, + grecs_type_string, GRECS_CONST, &control.realm, 0, NULL, }, { NULL } }; /* syslog */ static struct grecs_keyword syslog_kw[] = { {"facility", N_("name"), N_("Set syslog facility. Arg is one of the following: user, daemon, " "auth, authpriv, mail, cron, local0 through local7 (case-insensitive), " @@ -1369,57 +1369,57 @@ struct grecs_keyword pies_keywords[] = { NULL, N_("Set debug verbosity level."), grecs_type_uint, GRECS_DFLT, &debug_level, 0, NULL}, {"source-info", NULL, N_("Show source info with debugging messages."), grecs_type_bool, GRECS_DFLT, &source_info_option, 0, NULL}, {"state-directory", NULL, N_("Full file name of the program state directory."), - grecs_type_string, GRECS_DFLT, + grecs_type_string, GRECS_CONST, &statedir, 0, NULL}, {"pidfile", NULL, N_("Write PID to this file."), - grecs_type_string, GRECS_DFLT, + grecs_type_string, GRECS_CONST, &pidfile, 0, NULL, }, {"control-file", NULL, N_("Ignored for compatibility with version 1.2."), grecs_type_string, GRECS_DFLT|GRECS_INAC, NULL, 0, NULL, }, {"stat-file", NULL, N_("Ignored for compatibility with version 1.2."), grecs_type_string, GRECS_DFLT|GRECS_INAC, NULL, 0, NULL, }, {"qotd-file", NULL, N_("Set location of the QOTD file."), - grecs_type_string, GRECS_DFLT, + grecs_type_string, GRECS_CONST, &qotdfile, 0, NULL }, {"user", NULL, N_("Run with this user privileges."), - grecs_type_string, GRECS_DFLT, + grecs_type_string, GRECS_CONST, &pies_privs.user, 0, NULL, }, {"group", NULL, N_("Retain supplementary group."), grecs_type_string, GRECS_LIST, &pies_privs.groups, 0, NULL, }, {"allgroups", NULL, @@ -1479,39 +1479,39 @@ struct grecs_keyword pies_keywords[] = { NULL, 0, _cb_include_inetd }, {"include-meta1", N_("file: string"), N_("Include components from the specified MeTA1 configuration file."), grecs_type_string, GRECS_DFLT, NULL, 0, _cb_include_meta1, }, {"meta1-queue-dir", NULL, N_("Set the name of MeTA1 queue directory (default /var/spool/meta1)."), - grecs_type_string, GRECS_DFLT, + grecs_type_string, GRECS_CONST, &meta1_queue_dir, 0, NULL, }, {"mailer-program", NULL, N_("Full path to the mailer binary."), - grecs_type_string, GRECS_DFLT, + grecs_type_string, GRECS_CONST, &mailer_program, 0, NULL }, {"mailer-command-line", NULL, N_("Mailer command line (without recipient addresses)."), - grecs_type_string, GRECS_DFLT, + grecs_type_string, GRECS_CONST, &mailer_command_line, 0, NULL }, { "identity-provider", "name: string", "Configure identity provider", grecs_type_section, GRECS_INAC | GRECS_HIDDEN }, {NULL} }; void config_init () { grecs_include_path_setup (DEFAULT_VERSION_INCLUDE_DIR, |