summaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-01-11 14:02:59 -0500
committerNick Mathewson <nickm@torproject.org>2012-01-16 15:03:44 -0500
commit9c29369a04cdf47bd882579331577d82305bf785 (patch)
tree4a9752c89feb50c9fced1d18fdb4bbf24e3d9b72 /src/or/directory.c
parentcc02823d7f6acbc3fa8ea87e5646921100796f10 (diff)
downloadtor-9c29369a04cdf47bd882579331577d82305bf785.tar.gz
tor-9c29369a04cdf47bd882579331577d82305bf785.zip
Convert instances of tor_malloc+tor_snprintf into tor_asprintf
These were found by looking for tor_snprintf() instances that were preceeded closely by tor_malloc(), though I probably converted some more snprintfs as well. (In every case, make sure that the length variable (if any) is removed, renamed, or lowered, so that anything else that might have assumed a longer buffer doesn't exist.)
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 572091a16a..94c37f18d3 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -2463,11 +2463,9 @@ note_client_request(int purpose, int compressed, size_t bytes)
case DIR_PURPOSE_UPLOAD_RENDDESC_V2: kind = "dl/ul-rend2"; break;
}
if (kind) {
- key = tor_malloc(256);
- tor_snprintf(key, 256, "%s%s", kind, compressed?".z":"");
+ tor_asprintf(&key, "%s%s", kind, compressed?".z":"");
} else {
- key = tor_malloc(256);
- tor_snprintf(key, 256, "unknown purpose (%d)%s",
+ tor_asprintf(&key, "unknown purpose (%d)%s",
purpose, compressed?".z":"");
}
note_request(key, bytes);