summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2012-09-24 13:40:35 -0700
committerRuss Allbery <rra@stanford.edu>2012-09-24 13:40:35 -0700
commit87e93c01c354a45557873c7218898a07ca793a79 (patch)
tree7e149476d348c8e1711b923964c0765fd888c7d6 /server
parentbb15c7f52a4dc2a2f894f174b9d1fcbd487805b2 (diff)
Close some memory leaks in server configuration parsing
Free the configuration properly if configuration parsing fails with an error, and correctly free all of the allocated memory when freeing the configuration data. Change-Id: I67021ae6211b9dba0f944fa174acbaf1c11f81d8
Diffstat (limited to 'server')
-rw-r--r--server/config.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/server/config.c b/server/config.c
index c5dfe78..8e75e92 100644
--- a/server/config.c
+++ b/server/config.c
@@ -974,7 +974,7 @@ server_config_load(const char *file)
/* Read the configuration file. */
config = xcalloc(1, sizeof(struct config));
if (read_conf_file(config, file) != 0) {
- free(config);
+ server_config_free(config);
return NULL;
}
return config;
@@ -1002,6 +1002,7 @@ server_config_free(struct config *config)
vector_free(rule->line);
if (rule->file != NULL)
free(rule->file);
+ free(rule);
}
free(config->rules);
free(config);