[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Fix memory leak when retrieving networkstatus or routerdesc...
Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv20519/src/or
Modified Files:
directory.c
Log Message:
Fix memory leak when retrieving networkstatus or routerdesc by malformed fingerprint
Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.312
retrieving revision 1.313
diff -u -d -r1.312 -r1.313
--- directory.c 18 Oct 2005 17:09:56 -0000 1.312
+++ directory.c 25 Oct 2005 07:03:22 -0000 1.313
@@ -1678,21 +1678,23 @@
}
if (decode_hex) {
int i;
- char *cp, *d;
+ char *cp, *d = NULL;
for (i = 0; i < smartlist_len(fp_out); ++i) {
cp = smartlist_get(fp_out, i);
if (strlen(cp) != HEX_DIGEST_LEN) {
smartlist_del(fp_out, i--);
- continue;
+ goto again;
}
d = tor_malloc_zero(DIGEST_LEN);
if (base16_decode(d, DIGEST_LEN, cp, HEX_DIGEST_LEN)<0) {
- tor_free(d);
smartlist_del(fp_out, i--);
- continue;
+ goto again;
}
- tor_free(cp);
smartlist_set(fp_out, i, d);
+ d = NULL;
+ again:
+ tor_free(cp);
+ tor_free(d);
}
}
return 0;
- Prev by Author:
[or-cvs] Fix possible free(NULL) in control.c
- Next by Author:
[or-cvs] Convert circuituse, command, config, connection, relay, rou...
- Previous by thread:
[or-cvs] Fix possible free(NULL) in control.c
- Next by thread:
[or-cvs] Convert circuituse, command, config, connection, relay, rou...
- Index(es):