next = &list;
do {
+ k = v = NULL;
string = parse_config_line_from_str(string, &k, &v);
if (!string) {
config_free_lines(list);
+ tor_free(k);
+ tor_free(v);
return -1;
}
if (k && v) {
MAP_DEL_CURRENT(address);
}
} STRMAP_FOREACH_END;
+
+ tor_free(suffix);
}
/** Remove all entries from the addressmap that were set via the
* receive anything. */
write_http_status_line(conn, 400, "Nonauthoritative directory does not "
"accept posted server descriptors");
- return 0;
+ goto done;
}
if (authdir_mode_handles_descs(options, -1) &&
r = tor_snprintf(cp, buf_len - (cp-buf), "p %s\n", summary);
if (r<0) {
log_warn(LD_BUG, "Not enough space in buffer.");
+ tor_free(summary);
return -1;
}
cp += strlen(cp);
cleanup:
/* cleanup */
SMARTLIST_FOREACH(summary, policy_summary_item_t *, s, tor_free(s));
- smartlist_clear(summary);
+ smartlist_free(summary);
tor_free(accepts_str);
SMARTLIST_FOREACH(accepts, char *, s, tor_free(s));
- smartlist_clear(accepts);
+ smartlist_free(accepts);
tor_free(rejects_str);
SMARTLIST_FOREACH(rejects, char *, s, tor_free(s));
- smartlist_clear(rejects);
+ smartlist_free(rejects);
return result;
}
int res = -1;
strmap_t *parsed = strmap_new();
smartlist_t *sl = smartlist_create();
+ rend_service_authorization_t *auth = NULL;
for (line = options->HidServAuth; line; line = line->next) {
char *onion_address, *descriptor_cookie;
char descriptor_cookie_tmp[REND_DESC_COOKIE_LEN+2];
char descriptor_cookie_base64ext[REND_DESC_COOKIE_LEN_BASE64+2+1];
- rend_service_authorization_t *auth = NULL;
int auth_type_val = 0;
+ auth = NULL;
SMARTLIST_FOREACH(sl, char *, c, tor_free(c););
smartlist_clear(sl);
smartlist_split_string(sl, line->value, " ",
goto err;
}
strmap_set(parsed, auth->onion_address, auth);
+ auth = NULL;
}
res = 0;
goto done;
err:
res = -1;
done:
+ if (auth)
+ rend_service_authorization_free(auth);
SMARTLIST_FOREACH(sl, char *, c, tor_free(c););
smartlist_free(sl);
if (!validate_only && res == 0) {
if (!published && strmap_get_lc(rend_cache, key)) {
log_info(LD_REND, "We already have a v2 descriptor for service %s.",
safe_str(query));
+ rend_service_descriptor_free(parsed);
return -1;
}
/* report novel publication to statistics */
}
if (crypto_pk_generate_key(prkey)) {
log_warn(LD_BUG,"Error generating client key");
+ crypto_free_pk_env(prkey);
goto err;
}
if (crypto_pk_check_key(prkey) <= 0) {
goto err;
}
if (client->client_key) {
- char *client_key_out;
+ char *client_key_out = NULL;
crypto_pk_write_private_key_to_string(client->client_key,
&client_key_out, &len);
if (rend_get_service_id(client->client_key, service_id)<0) {
log_warn(LD_BUG, "Internal error: couldn't encode service ID.");
+ tor_free(client_key_out);
goto err;
}
written = tor_snprintf(buf + written, sizeof(buf) - written,
"client-key\n%s", client_key_out);
+ tor_free(client_key_out);
if (written < 0) {
log_warn(LD_BUG, "Could not write client entry.");
goto err;