summaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-08-21 11:01:44 -0400
committerNick Mathewson <nickm@torproject.org>2014-08-21 11:22:42 -0400
commit059e33de59030b008193512b58a51be922fffea4 (patch)
tree99a0d1e1e7c3cca85078e2aa0fa1ec013d907bb5 /src/or/dirserv.c
parent917e1042f75e9db2836def41210fa756c8ca3a85 (diff)
downloadtor-059e33de59030b008193512b58a51be922fffea4.tar.gz
tor-059e33de59030b008193512b58a51be922fffea4.zip
remove meaningless checks for chunks==NULL in dirserv stuff
Also, make it clearer that chunks cannot be NULL [CID 1031750, 1031751]
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index f33437ff52..52258e875f 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1959,13 +1959,12 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
char published[ISO_TIME_LEN+1];
char identity64[BASE64_DIGEST_LEN+1];
char digest64[BASE64_DIGEST_LEN+1];
- smartlist_t *chunks = NULL;
+ smartlist_t *chunks = smartlist_new();
format_iso_time(published, rs->published_on);
digest_to_base64(identity64, rs->identity_digest);
digest_to_base64(digest64, rs->descriptor_digest);
- chunks = smartlist_new();
smartlist_add_asprintf(chunks,
"r %s %s %s%s%s %s %d %d\n",
rs->nickname,
@@ -2090,10 +2089,8 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
result = smartlist_join_strings(chunks, "", 0, NULL);
err:
- if (chunks) {
- SMARTLIST_FOREACH(chunks, char *, cp, tor_free(cp));
- smartlist_free(chunks);
- }
+ SMARTLIST_FOREACH(chunks, char *, cp, tor_free(cp));
+ smartlist_free(chunks);
return result;
}