Fix a few small memory leaks.

This commit is contained in:
Guus Sliepen 2011-12-26 23:11:27 +01:00
parent b50d6a7f2a
commit 1f00111e94
3 changed files with 8 additions and 3 deletions

View file

@ -547,9 +547,6 @@ static bool setup_myself(void) {
/* Check if we want to use message authentication codes... */ /* Check if we want to use message authentication codes... */
if(!get_config_string(lookup_config(config_tree, "Digest"), &digest))
digest = xstrdup("sha1");
int maclength = 4; int maclength = 4;
get_config_int(lookup_config(config_tree, "MACLength"), &maclength); get_config_int(lookup_config(config_tree, "MACLength"), &maclength);
@ -558,6 +555,9 @@ static bool setup_myself(void) {
return false; return false;
} }
if(!get_config_string(lookup_config(config_tree, "Digest"), &digest))
digest = xstrdup("sha1");
if(!digest_open_by_name(&myself->indigest, digest, maclength)) { if(!digest_open_by_name(&myself->indigest, digest, maclength)) {
logger(LOG_ERR, "Unrecognized digest type!"); logger(LOG_ERR, "Unrecognized digest type!");
return false; return false;

View file

@ -469,6 +469,8 @@ void subnet_update(node_t *owner, subnet_t *subnet, bool up) {
// 4 and 5 are reserved for SUBNET and WEIGHT // 4 and 5 are reserved for SUBNET and WEIGHT
xasprintf(&envp[6], "REMOTEADDRESS=%s", address); xasprintf(&envp[6], "REMOTEADDRESS=%s", address);
xasprintf(&envp[7], "REMOTEPORT=%s", port); xasprintf(&envp[7], "REMOTEPORT=%s", port);
free(port);
free(address);
} }
name = up ? "subnet-up" : "subnet-down"; name = up ? "subnet-up" : "subnet-down";

View file

@ -493,9 +493,12 @@ end:
end_nonet: end_nonet:
logger(LOG_NOTICE, "Terminating"); logger(LOG_NOTICE, "Terminating");
free(priority);
crypto_exit(); crypto_exit();
exit_configuration(&config_tree); exit_configuration(&config_tree);
free(cmdline_conf);
free_names(); free_names();
return status; return status;