if (!dh_param_p)
init_dh_param();
- res = tor_malloc(sizeof(crypto_dh_env_t));
- res->dh = NULL;
+ res = tor_malloc_zero(sizeof(crypto_dh_env_t));
if (!(res->dh = DH_new()))
goto err;
init_options(or_options_t *options)
{
memset(options,0,sizeof(or_options_t));
- options->LogOptions = NULL;
options->ExitNodes = tor_strdup("");
options->EntryNodes = tor_strdup("");
options->StrictEntryNodes = options->StrictExitNodes = 0;
options->ExcludeNodes = tor_strdup("");
options->RendNodes = tor_strdup("");
options->RendExcludeNodes = tor_strdup("");
- options->ExitPolicy = NULL;
- options->SocksPolicy = NULL;
- options->SocksBindAddress = NULL;
- options->ORBindAddress = NULL;
- options->DirBindAddress = NULL;
- options->OutboundBindAddress = NULL;
- options->RecommendedVersions = NULL;
- options->PidFile = NULL; // tor_strdup("tor.pid");
- options->DataDirectory = NULL;
+ /* options->PidFile = tor_strdup("tor.pid"); */
options->PathlenCoinWeight = 0.3;
options->MaxConn = 900;
options->DirFetchPostPeriod = 600;
options->BandwidthRate = 800000; /* at most 800kB/s total sustained incoming */
options->BandwidthBurst = 10000000; /* max burst on the token bucket */
options->NumCpus = 1;
- options->RendConfigLines = NULL;
- options->FirewallPorts = NULL;
- options->DirServers = NULL;
- options->MyFamily = NULL;
- options->NodeFamilies = NULL;
}
static char *
/* add us to the pending list */
pending_connection = tor_malloc_zero(sizeof(struct pending_connection_t));
pending_connection->conn = exitconn;
- pending_connection->next = NULL;
resolve->pending_connections = pending_connection;
exitconn->state = EXIT_CONN_STATE_RESOLVING;
int onion_pending_add(circuit_t *circ) {
struct onion_queue_t *tmp;
- tmp = tor_malloc(sizeof(struct onion_queue_t));
+ tmp = tor_malloc_zero(sizeof(struct onion_queue_t));
tmp->circ = circ;
- tmp->next = NULL;
if(!ol_tail) {
tor_assert(!ol_list);
ri->bandwidthrate = options.BandwidthRate;
ri->bandwidthburst = options.BandwidthBurst;
ri->bandwidthcapacity = router_get_bandwidth_capacity();
- ri->exit_policy = NULL; /* zero it out first */
router_add_exit_policy_from_config(ri);
ri->is_trusted_dir = authdir_mode();
if(desc_routerinfo) /* inherit values */
ri->declared_family = smartlist_create();
smartlist_split_string(ri->declared_family, options.MyFamily, ",",
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
- } else {
- ri->declared_family = NULL;
}
if (desc_routerinfo)
(int) router->bandwidthcapacity,
onion_pkey, identity_pkey,
family_line, bandwidth_usage);
-
+ tor_free(family_line);
tor_free(onion_pkey);
tor_free(identity_pkey);
tor_free(bandwidth_usage);
if (*dest)
routerlist_free(*dest);
- *dest = tor_malloc(sizeof(routerlist_t));
+ *dest = tor_malloc_zero(sizeof(routerlist_t));
(*dest)->routers = routers;
- (*dest)->software_versions = NULL;
return 0;
}
}
router = tor_malloc_zero(sizeof(routerinfo_t));
- router->onion_pkey = router->identity_pkey = NULL;
- router->declared_family = NULL;
ports_set = bw_set = 0;
if (tok->n_args == 2 || tok->n_args == 5 || tok->n_args == 6) {
address, inet_ntoa(in), newe->prt_min, newe->prt_max);
tor_free(address);
- newe->next = NULL;
return newe;
policy_read_failed: