[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Fix possible minor memory leak when parsing helpernode state
Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv20272/src/or
Modified Files:
circuitbuild.c
Log Message:
Fix possible minor memory leak when parsing helpernode state
Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -d -r1.154 -r1.155
--- circuitbuild.c 24 Oct 2005 19:37:45 -0000 1.154
+++ circuitbuild.c 25 Oct 2005 07:00:03 -0000 1.155
@@ -150,7 +150,7 @@
* exit point.
*/
void
-circuit_log_path(int severity, int domain, circuit_t *circ)
+circuit_log_path(int severity, unsigned int domain, circuit_t *circ)
{
char *s = circuit_list_path(circ,1);
log(severity,domain,"%s",s);
@@ -641,8 +641,7 @@
char tmpbuf[INET_NTOA_BUF_LEN];
in.s_addr = htonl(circ->n_addr);
tor_inet_ntoa(&in,tmpbuf,sizeof(tmpbuf));
- /* XXXX LD_OR? NM */
- info(LD_CIRC,"Next router (%s:%d) not connected. Connecting.",
+ info(LD_CIRC|LD_OR,"Next router (%s:%d) not connected. Connecting.",
tmpbuf, circ->n_port);
memcpy(circ->onionskin, onionskin, ONIONSKIN_CHALLENGE_LEN);
@@ -1217,7 +1216,6 @@
return router;
}
if (options->StrictExitNodes) {
- /* XXXX NM LD_DIR? */
warn(LD_CIRC, "No exit routers seem to be running; can't choose an exit.");
}
return NULL;
@@ -1880,18 +1878,19 @@
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
if (smartlist_len(args)<2) {
*err = "Too few arguments to HelperNode";
- break;
- }
- if (!is_legal_nickname(smartlist_get(args,0))) {
+ } else if (!is_legal_nickname(smartlist_get(args,0))) {
*err = "Bad nickname for HelperNode";
- break;
+ } else {
+ strlcpy(node->nickname, smartlist_get(args,0), MAX_NICKNAME_LEN+1);
+ if (base16_decode(node->identity, DIGEST_LEN, smartlist_get(args,1),
+ strlen(smartlist_get(args,1)))<0) {
+ *err = "Bad hex digest for HelperNode";
+ }
}
- strlcpy(node->nickname, smartlist_get(args,0), MAX_NICKNAME_LEN+1);
- if (base16_decode(node->identity, DIGEST_LEN, smartlist_get(args,1),
- strlen(smartlist_get(args,1)))<0) {
- *err = "Bad hex digest for HelperNode";
+ SMARTLIST_FOREACH(args, char*, cp, tor_free(cp));
+ smartlist_free(args);
+ if (*err)
break;
- }
} else {
time_t when;
if (!node) {