Commit e4127e4d authored by Roger Dingledine's avatar Roger Dingledine
Browse files

move closer to being able to reload config on HUP

rename APPort to SocksPort
introduce new tor_free() macro


svn:r642
parent 80d428b2
...@@ -481,7 +481,7 @@ void circuit_close(circuit_t *circ) { ...@@ -481,7 +481,7 @@ void circuit_close(circuit_t *circ) {
circuit_t *youngest=NULL; circuit_t *youngest=NULL;
assert(circ); assert(circ);
if(options.APPort) { if(options.SocksPort) {
youngest = circuit_get_newest_open(); youngest = circuit_get_newest_open();
log_fn(LOG_DEBUG,"youngest %d, circ %d.",(int)youngest, (int)circ); log_fn(LOG_DEBUG,"youngest %d, circ %d.",(int)youngest, (int)circ);
} }
...@@ -496,7 +496,7 @@ void circuit_close(circuit_t *circ) { ...@@ -496,7 +496,7 @@ void circuit_close(circuit_t *circ) {
for(conn=circ->p_streams; conn; conn=conn->next_stream) { for(conn=circ->p_streams; conn; conn=conn->next_stream) {
connection_send_destroy(circ->p_aci, conn); connection_send_destroy(circ->p_aci, conn);
} }
if(options.APPort && youngest == circ) { /* check this after we've sent the destroys, to reduce races */ if(options.SocksPort && youngest == circ) { /* check this after we've sent the destroys, to reduce races */
/* our current circuit just died. Launch another one pronto. */ /* our current circuit just died. Launch another one pronto. */
log_fn(LOG_INFO,"Youngest circuit dying. Launching a replacement."); log_fn(LOG_INFO,"Youngest circuit dying. Launching a replacement.");
circuit_launch_new(1); circuit_launch_new(1);
...@@ -616,7 +616,7 @@ void circuit_expire_unused_circuits(void) { ...@@ -616,7 +616,7 @@ void circuit_expire_unused_circuits(void) {
void circuit_launch_new(int failure_status) { void circuit_launch_new(int failure_status) {
static int failures=0; static int failures=0;
if(!options.APPort) /* we're not an application proxy. no need for circuits. */ if(!options.SocksPort) /* we're not an application proxy. no need for circuits. */
return; return;
if(failure_status == -1) { /* I was called because a circuit succeeded */ if(failure_status == -1) { /* I was called because a circuit succeeded */
......
...@@ -131,6 +131,7 @@ static int config_compare(struct config_line *c, char *key, int type, void *arg) ...@@ -131,6 +131,7 @@ static int config_compare(struct config_line *c, char *key, int type, void *arg)
*(int *)arg = i; *(int *)arg = i;
break; break;
case CONFIG_TYPE_STRING: case CONFIG_TYPE_STRING:
tor_free(*(char **)arg);
*(char **)arg = tor_strdup(c->value); *(char **)arg = tor_strdup(c->value);
break; break;
case CONFIG_TYPE_DOUBLE: case CONFIG_TYPE_DOUBLE:
...@@ -159,10 +160,12 @@ static void config_assign(or_options_t *options, struct config_line *list) { ...@@ -159,10 +160,12 @@ static void config_assign(or_options_t *options, struct config_line *list) {
config_compare(list, "Nickname", CONFIG_TYPE_STRING, &options->Nickname) || config_compare(list, "Nickname", CONFIG_TYPE_STRING, &options->Nickname) ||
config_compare(list, "Address", CONFIG_TYPE_STRING, &options->Address) || config_compare(list, "Address", CONFIG_TYPE_STRING, &options->Address) ||
config_compare(list, "ExitPolicy", CONFIG_TYPE_STRING, &options->ExitPolicy) || config_compare(list, "ExitPolicy", CONFIG_TYPE_STRING, &options->ExitPolicy) ||
config_compare(list, "SocksBindAddress",CONFIG_TYPE_STRING,&options->SocksBindAddress) ||
config_compare(list, "ORBindAddress", CONFIG_TYPE_STRING, &options->ORBindAddress) ||
/* int options */ /* int options */
config_compare(list, "MaxConn", CONFIG_TYPE_INT, &options->MaxConn) || config_compare(list, "MaxConn", CONFIG_TYPE_INT, &options->MaxConn) ||
config_compare(list, "APPort", CONFIG_TYPE_INT, &options->APPort) || config_compare(list, "SocksPort", CONFIG_TYPE_INT, &options->SocksPort) ||
config_compare(list, "ORPort", CONFIG_TYPE_INT, &options->ORPort) || config_compare(list, "ORPort", CONFIG_TYPE_INT, &options->ORPort) ||
config_compare(list, "DirPort", CONFIG_TYPE_INT, &options->DirPort) || config_compare(list, "DirPort", CONFIG_TYPE_INT, &options->DirPort) ||
config_compare(list, "DirFetchPostPeriod",CONFIG_TYPE_INT, &options->DirFetchPostPeriod) || config_compare(list, "DirFetchPostPeriod",CONFIG_TYPE_INT, &options->DirFetchPostPeriod) ||
...@@ -195,20 +198,27 @@ void print_usage(void) { ...@@ -195,20 +198,27 @@ void print_usage(void) {
} }
/* return 0 if success, <0 if failure. */ void free_options(or_options_t *options) {
int getconfig(int argc, char **argv, or_options_t *options) { tor_free(options->LogLevel);
struct config_line *cl; tor_free(options->LogFile);
FILE *cf; tor_free(options->DebugLogFile);
char *fname; tor_free(options->DataDirectory);
int i; tor_free(options->RouterFile);
int result = 0; tor_free(options->Nickname);
tor_free(options->Address);
tor_free(options->PidFile);
tor_free(options->ExitPolicy);
}
void init_options(or_options_t *options) {
/* give reasonable values for each option. Defaults to zero. */ /* give reasonable values for each option. Defaults to zero. */
memset(options,0,sizeof(or_options_t)); memset(options,0,sizeof(or_options_t));
options->LogLevel = "info"; options->LogLevel = tor_strdup("info");
options->ExitPolicy = "reject 127.0.0.1:*,reject 18.244.0.188:25,accept *:*"; options->ExitPolicy = tor_strdup("reject 127.0.0.1:*,reject 18.244.0.188:25,accept *:*");
options->SocksBindAddress = tor_strdup("127.0.0.1");
options->ORBindAddress = tor_strdup("0.0.0.0");
options->loglevel = LOG_INFO; options->loglevel = LOG_INFO;
options->PidFile = "tor.pid"; options->PidFile = tor_strdup("tor.pid");
options->DataDirectory = NULL; options->DataDirectory = NULL;
options->CoinWeight = 0.1; options->CoinWeight = 0.1;
options->MaxConn = 900; options->MaxConn = 900;
...@@ -218,6 +228,17 @@ int getconfig(int argc, char **argv, or_options_t *options) { ...@@ -218,6 +228,17 @@ int getconfig(int argc, char **argv, or_options_t *options) {
options->NewCircuitPeriod = 60; /* once a minute */ options->NewCircuitPeriod = 60; /* once a minute */
options->TotalBandwidth = 800000; /* at most 800kB/s total sustained incoming */ options->TotalBandwidth = 800000; /* at most 800kB/s total sustained incoming */
options->NumCpus = 1; options->NumCpus = 1;
}
/* return 0 if success, <0 if failure. */
int getconfig(int argc, char **argv, or_options_t *options) {
struct config_line *cl;
FILE *cf;
char *fname;
int i;
int result = 0;
init_options(options);
if(argc > 1 && (!strcmp(argv[1], "-h") || !strcmp(argv[1],"--help"))) { if(argc > 1 && (!strcmp(argv[1], "-h") || !strcmp(argv[1],"--help"))) {
print_usage(); print_usage();
...@@ -295,8 +316,8 @@ int getconfig(int argc, char **argv, or_options_t *options) { ...@@ -295,8 +316,8 @@ int getconfig(int argc, char **argv, or_options_t *options) {
result = -1; result = -1;
} }
if(options->APPort < 0) { if(options->SocksPort < 0) {
log(LOG_WARN,"APPort option can't be negative."); log(LOG_WARN,"SocksPort option can't be negative.");
result = -1; result = -1;
} }
...@@ -305,7 +326,7 @@ int getconfig(int argc, char **argv, or_options_t *options) { ...@@ -305,7 +326,7 @@ int getconfig(int argc, char **argv, or_options_t *options) {
result = -1; result = -1;
} }
if(options->APPort > 1 && if(options->SocksPort > 1 &&
(options->CoinWeight < 0.0 || options->CoinWeight >= 1.0)) { (options->CoinWeight < 0.0 || options->CoinWeight >= 1.0)) {
log(LOG_WARN,"CoinWeight option must be >=0.0 and <1.0."); log(LOG_WARN,"CoinWeight option must be >=0.0 and <1.0.");
result = -1; result = -1;
......
...@@ -100,8 +100,7 @@ void connection_free(connection_t *conn) { ...@@ -100,8 +100,7 @@ void connection_free(connection_t *conn) {
buf_free(conn->inbuf); buf_free(conn->inbuf);
buf_free(conn->outbuf); buf_free(conn->outbuf);
} }
if(conn->address) tor_free(conn->address);
free(conn->address);
if(connection_speaks_cells(conn)) { if(connection_speaks_cells(conn)) {
directory_set_dirty(); directory_set_dirty();
...@@ -115,8 +114,7 @@ void connection_free(connection_t *conn) { ...@@ -115,8 +114,7 @@ void connection_free(connection_t *conn) {
crypto_free_pk_env(conn->link_pkey); crypto_free_pk_env(conn->link_pkey);
if (conn->identity_pkey) if (conn->identity_pkey)
crypto_free_pk_env(conn->identity_pkey); crypto_free_pk_env(conn->identity_pkey);
if (conn->nickname) tor_free(conn->nickname);
free(conn->nickname);
if(conn->s >= 0) { if(conn->s >= 0) {
log_fn(LOG_INFO,"closing fd %d.",conn->s); log_fn(LOG_INFO,"closing fd %d.",conn->s);
......
...@@ -85,8 +85,7 @@ void connection_or_init_conn_from_router(connection_t *conn, routerinfo_t *route ...@@ -85,8 +85,7 @@ void connection_or_init_conn_from_router(connection_t *conn, routerinfo_t *route
conn->link_pkey = crypto_pk_dup_key(router->link_pkey); conn->link_pkey = crypto_pk_dup_key(router->link_pkey);
conn->identity_pkey = crypto_pk_dup_key(router->identity_pkey); conn->identity_pkey = crypto_pk_dup_key(router->identity_pkey);
conn->nickname = tor_strdup(router->nickname); conn->nickname = tor_strdup(router->nickname);
if(conn->address) tor_free(conn->address);
free(conn->address);
conn->address = tor_strdup(router->address); conn->address = tor_strdup(router->address);
} }
......
...@@ -165,10 +165,8 @@ static int n_descriptors = 0; ...@@ -165,10 +165,8 @@ static int n_descriptors = 0;
static void free_descriptor_entry(descriptor_entry_t *desc) static void free_descriptor_entry(descriptor_entry_t *desc)
{ {
if (desc->descriptor) tor_free(desc->descriptor);
free(desc->descriptor); tor_free(desc->nickname);
if (desc->nickname)
free(desc->nickname);
free(desc); free(desc);
} }
...@@ -218,7 +216,7 @@ dirserv_add_descriptor(const char **desc) ...@@ -218,7 +216,7 @@ dirserv_add_descriptor(const char **desc)
log(LOG_WARN, "Couldn't parse descriptor"); log(LOG_WARN, "Couldn't parse descriptor");
goto err; goto err;
} }
free(desc_tmp); desc_tmp = NULL; tor_free(desc_tmp);
/* Okay. Now check whether the fingerprint is recognized. */ /* Okay. Now check whether the fingerprint is recognized. */
if (!dirserv_router_fingerprint_is_known(ri)) { if (!dirserv_router_fingerprint_is_known(ri)) {
log(LOG_WARN, "Identity is unrecognized for descriptor"); log(LOG_WARN, "Identity is unrecognized for descriptor");
...@@ -238,7 +236,7 @@ dirserv_add_descriptor(const char **desc) ...@@ -238,7 +236,7 @@ dirserv_add_descriptor(const char **desc)
/* We already have a newer descriptor */ /* We already have a newer descriptor */
log_fn(LOG_INFO,"We already have a newer desc for nickname %s. Not adding.",ri->nickname); log_fn(LOG_INFO,"We already have a newer desc for nickname %s. Not adding.",ri->nickname);
/* This isn't really an error; return. */ /* This isn't really an error; return. */
if (desc_tmp) free(desc_tmp); tor_free(desc_tmp);
if (ri) routerinfo_free(ri); if (ri) routerinfo_free(ri);
*desc = end; *desc = end;
return 0; return 0;
...@@ -263,8 +261,7 @@ dirserv_add_descriptor(const char **desc) ...@@ -263,8 +261,7 @@ dirserv_add_descriptor(const char **desc)
routerinfo_free(ri); routerinfo_free(ri);
return 0; return 0;
err: err:
if (desc_tmp) tor_free(desc_tmp);
free(desc_tmp);
if (ri) if (ri)
routerinfo_free(ri); routerinfo_free(ri);
...@@ -417,8 +414,7 @@ size_t dirserv_get_directory(const char **directory) ...@@ -417,8 +414,7 @@ size_t dirserv_get_directory(const char **directory)
free(new_directory); free(new_directory);
return 0; return 0;
} }
if (the_directory) tor_free(the_directory);
free(the_directory);
the_directory = new_directory; the_directory = new_directory;
the_directory_len = strlen(the_directory); the_directory_len = strlen(the_directory);
log_fn(LOG_INFO,"New directory (size %d):\n%s",the_directory_len, log_fn(LOG_INFO,"New directory (size %d):\n%s",the_directory_len,
......
...@@ -337,7 +337,7 @@ static void run_scheduled_events(time_t now) { ...@@ -337,7 +337,7 @@ static void run_scheduled_events(time_t now) {
/* 2. Every NewCircuitPeriod seconds, we expire old circuits and make a /* 2. Every NewCircuitPeriod seconds, we expire old circuits and make a
* new one as needed. * new one as needed.
*/ */
if(options.APPort && time_to_new_circuit < now) { if(options.SocksPort && time_to_new_circuit < now) {
circuit_expire_unused_circuits(); circuit_expire_unused_circuits();
circuit_launch_new(-1); /* tell it to forget about previous failures */ circuit_launch_new(-1); /* tell it to forget about previous failures */
circ = circuit_get_newest_open(); circ = circuit_get_newest_open();
...@@ -595,7 +595,7 @@ static int do_main_loop(void) { ...@@ -595,7 +595,7 @@ static int do_main_loop(void) {
* and start the listeners. * and start the listeners.
*/ */
retry_all_connections((uint16_t) options.ORPort, retry_all_connections((uint16_t) options.ORPort,
(uint16_t) options.APPort, (uint16_t) options.SocksPort,
(uint16_t) options.DirPort); (uint16_t) options.DirPort);
for(;;) { for(;;) {
......
...@@ -222,7 +222,7 @@ static unsigned int *new_route(double cw, routerinfo_t **rarray, int rarray_len, ...@@ -222,7 +222,7 @@ static unsigned int *new_route(double cw, routerinfo_t **rarray, int rarray_len,
for(i=0;i<*routelen;i++) { for(i=0;i<*routelen;i++) {
// log_fn(LOG_DEBUG,"Choosing hop %u.",i); // log_fn(LOG_DEBUG,"Choosing hop %u.",i);
if (CRYPTO_PSEUDO_RAND_INT(choice)) { if (CRYPTO_PSEUDO_RAND_INT(choice)) {
free((void *)route); free(route);
return NULL; return NULL;
} }
...@@ -432,7 +432,7 @@ onion_skin_create(crypto_pk_env_t *dest_router_key, ...@@ -432,7 +432,7 @@ onion_skin_create(crypto_pk_env_t *dest_router_key,
return 0; return 0;
err: err:
if (pubkey) free(pubkey); tor_free(pubkey);
if (dh) crypto_dh_free(dh); if (dh) crypto_dh_free(dh);
if (cipher) crypto_free_cipher_env(cipher); if (cipher) crypto_free_cipher_env(cipher);
return -1; return -1;
......
...@@ -335,7 +335,7 @@ typedef struct { ...@@ -335,7 +335,7 @@ typedef struct {
uint32_t addr; /* all host order */ uint32_t addr; /* all host order */
uint16_t or_port; uint16_t or_port;
uint16_t ap_port; uint16_t socks_port;
uint16_t dir_port; uint16_t dir_port;
time_t published_on; time_t published_on;
...@@ -426,9 +426,11 @@ typedef struct { ...@@ -426,9 +426,11 @@ typedef struct {
char *Address; char *Address;
char *PidFile; char *PidFile;
char *ExitPolicy; char *ExitPolicy;
char *SocksBindAddress;
char *ORBindAddress;
double CoinWeight; double CoinWeight;
int ORPort; int ORPort;
int APPort; int SocksPort;
int DirPort; int DirPort;
int MaxConn; int MaxConn;
int OnionRouter; int OnionRouter;
......
...@@ -144,10 +144,8 @@ void routerinfo_free(routerinfo_t *router) ...@@ -144,10 +144,8 @@ void routerinfo_free(routerinfo_t *router)
if (!router) if (!router)
return; return;
if (router->address) tor_free(router->address);
free(router->address); tor_free(router->nickname);
if (router->nickname)
free(router->nickname);
if (router->onion_pkey) if (router->onion_pkey)
crypto_free_pk_env(router->onion_pkey); crypto_free_pk_env(router->onion_pkey);
if (router->link_pkey) if (router->link_pkey)
...@@ -157,9 +155,9 @@ void routerinfo_free(routerinfo_t *router) ...@@ -157,9 +155,9 @@ void routerinfo_free(routerinfo_t *router)
while (router->exit_policy) { while (router->exit_policy) {
e = router->exit_policy; e = router->exit_policy;
router->exit_policy = e->next; router->exit_policy = e->next;
if (e->string) free(e->string); tor_free(e->string);
if (e->address) free(e->address); tor_free(e->address);
if (e->port) free(e->port); tor_free(e->port);
free(e); free(e);
} }
free(router); free(router);
...@@ -170,10 +168,8 @@ void directory_free(directory_t *dir) ...@@ -170,10 +168,8 @@ void directory_free(directory_t *dir)
int i; int i;
for (i = 0; i < dir->n_routers; ++i) for (i = 0; i < dir->n_routers; ++i)
routerinfo_free(dir->routers[i]); routerinfo_free(dir->routers[i]);
if (dir->routers) tor_free(dir->routers);
free(dir->routers); tor_free(dir->software_versions);
if(dir->software_versions)
free(dir->software_versions);
free(dir); free(dir);
} }
...@@ -825,8 +821,8 @@ routerinfo_t *router_get_entry_from_string(char**s) { ...@@ -825,8 +821,8 @@ routerinfo_t *router_get_entry_from_string(char**s) {
goto err; goto err;
} }
/* Router->ap_port */ /* Router->socks_port */
router->ap_port = atoi(ARGS[3]); router->socks_port = atoi(ARGS[3]);
/* Router->dir_port */ /* Router->dir_port */
router->dir_port = atoi(ARGS[4]); router->dir_port = atoi(ARGS[4]);
...@@ -838,8 +834,8 @@ routerinfo_t *router_get_entry_from_string(char**s) { ...@@ -838,8 +834,8 @@ routerinfo_t *router_get_entry_from_string(char**s) {
goto err; goto err;
} }
log_fn(LOG_DEBUG,"or_port %d, ap_port %d, dir_port %d, bandwidth %d.", log_fn(LOG_DEBUG,"or_port %d, socks_port %d, dir_port %d, bandwidth %d.",
router->or_port, router->ap_port, router->dir_port, router->bandwidth); router->or_port, router->socks_port, router->dir_port, router->bandwidth);
/* XXX Later, require platform before published. */ /* XXX Later, require platform before published. */
NEXT_TOKEN(); NEXT_TOKEN();
...@@ -1039,12 +1035,9 @@ static int router_add_exit_policy(routerinfo_t *router, ...@@ -1039,12 +1035,9 @@ static int router_add_exit_policy(routerinfo_t *router,
policy_read_failed: policy_read_failed:
assert(newe->string); assert(newe->string);
log_fn(LOG_WARN,"Couldn't parse line '%s'. Dropping", newe->string); log_fn(LOG_WARN,"Couldn't parse line '%s'. Dropping", newe->string);
if(newe->string) tor_free(newe->string);
free(newe->string); tor_free(newe->address);
if(newe->address) tor_free(newe->port);
free(newe->address);
if(newe->port)
free(newe->port);
free(newe); free(newe);
return -1; return -1;
} }
...@@ -1121,7 +1114,7 @@ int router_rebuild_descriptor(void) { ...@@ -1121,7 +1114,7 @@ int router_rebuild_descriptor(void) {
ri->nickname = tor_strdup(options.Nickname); ri->nickname = tor_strdup(options.Nickname);
/* No need to set addr. */ /* No need to set addr. */
ri->or_port = options.ORPort; ri->or_port = options.ORPort;
ri->ap_port = options.APPort; ri->socks_port = options.SocksPort;
ri->dir_port = options.DirPort; ri->dir_port = options.DirPort;
ri->published_on = time(NULL); ri->published_on = time(NULL);
ri->onion_pkey = crypto_pk_dup_key(get_onion_key()); ri->onion_pkey = crypto_pk_dup_key(get_onion_key());
...@@ -1202,7 +1195,7 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router, ...@@ -1202,7 +1195,7 @@ int router_dump_router_to_string(char *s, int maxlen, routerinfo_t *router,
router->nickname, router->nickname,
router->address, router->address,
router->or_port, router->or_port,
router->ap_port, router->socks_port,
router->dir_port, router->dir_port,
router->bandwidth, router->bandwidth,
platform, platform,
......
...@@ -517,7 +517,7 @@ test_dir_format() ...@@ -517,7 +517,7 @@ test_dir_format()
r1.addr = 0xc0a80001u; /* 192.168.0.1 */ r1.addr = 0xc0a80001u; /* 192.168.0.1 */
r1.published_on = 0; r1.published_on = 0;
r1.or_port = 9000; r1.or_port = 9000;
r1.ap_port = 9002; r1.socks_port = 9002;
r1.dir_port = 9003; r1.dir_port = 9003;
r1.onion_pkey = pk1; r1.onion_pkey = pk1;
r1.identity_pkey = pk2; r1.identity_pkey = pk2;
...@@ -539,7 +539,7 @@ test_dir_format() ...@@ -539,7 +539,7 @@ test_dir_format()
r2.addr = 0x0a030201u; /* 10.3.2.1 */ r2.addr = 0x0a030201u; /* 10.3.2.1 */
r2.published_on = 5; r2.published_on = 5;
r2.or_port = 9005; r2.or_port = 9005;
r2.ap_port = 0; r2.socks_port = 0;
r2.dir_port = 0; r2.dir_port = 0;
r2.onion_pkey = pk2; r2.onion_pkey = pk2;
r2.identity_pkey = pk1; r2.identity_pkey = pk1;
...@@ -580,7 +580,7 @@ test_dir_format() ...@@ -580,7 +580,7 @@ test_dir_format()
test_assert(rp1); test_assert(rp1);
test_streq(rp1->address, r1.address); test_streq(rp1->address, r1.address);
test_eq(rp1->or_port, r1.or_port); test_eq(rp1->or_port, r1.or_port);
test_eq(rp1->ap_port, r1.ap_port); test_eq(rp1->socks_port, r1.socks_port);
test_eq(rp1->dir_port, r1.dir_port); test_eq(rp1->dir_port, r1.dir_port);
test_eq(rp1->bandwidth, r1.bandwidth); test_eq(rp1->bandwidth, r1.bandwidth);
test_assert(crypto_pk_cmp_keys(rp1->onion_pkey, pk1) == 0); test_assert(crypto_pk_cmp_keys(rp1->onion_pkey, pk1) == 0);
...@@ -603,7 +603,7 @@ test_dir_format() ...@@ -603,7 +603,7 @@ test_dir_format()
test_assert(rp2); test_assert(rp2);
test_streq(rp2->address, r2.address); test_streq(rp2->address, r2.address);
test_eq(rp2->or_port, r2.or_port); test_eq(rp2->or_port, r2.or_port);
test_eq(rp2->ap_port, r2.ap_port); test_eq(rp2->socks_port, r2.socks_port);
test_eq(rp2->dir_port, r2.dir_port); test_eq(rp2->dir_port, r2.dir_port);
test_eq(rp2->bandwidth, r2.bandwidth); test_eq(rp2->bandwidth, r2.bandwidth);
test_assert(crypto_pk_cmp_keys(rp2->onion_pkey, pk2) == 0); test_assert(crypto_pk_cmp_keys(rp2->onion_pkey, pk2) == 0);
...@@ -636,14 +636,14 @@ test_dir_format() ...@@ -636,14 +636,14 @@ test_dir_format()
test_eq(2, dir2->n_routers); test_eq(2, dir2->n_routers);
#endif #endif
if (pk1_str) free(pk1_str); tor_free(pk1_str);
if (pk2_str) free(pk2_str); tor_free(pk2_str);
if (pk1) crypto_free_pk_env(pk1); if (pk1) crypto_free_pk_env(pk1);
if (pk2) crypto_free_pk_env(pk2); if (pk2) crypto_free_pk_env(pk2);
if (rp1) routerinfo_free(rp1); if (rp1) routerinfo_free(rp1);
if (rp2) routerinfo_free(rp2); if (rp2) routerinfo_free(rp2);
if (dir1) free(dir1); /* And more !*/ tor_free(dir1); /* And more !*/
if (dir1) free(dir2); /* And more !*/ tor_free(dir2); /* And more !*/
/* make sure compare_recommended_versions() works */ /* make sure compare_recommended_versions() works */
test_eq(0, compare_recommended_versions("abc", "abc")); test_eq(0, compare_recommended_versions("abc", "abc"));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment