]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Use tor_malloc_zero(x), not tor_calloc(x,sizeof(char))
authorNick Mathewson <nickm@torproject.org>
Sun, 2 Nov 2014 17:08:51 +0000 (12:08 -0500)
committerNick Mathewson <nickm@torproject.org>
Sun, 2 Nov 2014 17:08:51 +0000 (12:08 -0500)
(Also, fixes a wide line.)

src/common/util.c

index 77102837db56979402a1c2aaab430039642d8a2b..27cc9df87869451783be4ea356289a89de5a539f 100644 (file)
@@ -3465,8 +3465,9 @@ format_win_cmdline_argument(const char *arg)
     smartlist_add(arg_chars, (void*)&backslash);
 
   /* Allocate space for argument, quotes (if needed), and terminator */
-  formatted_arg = tor_calloc((smartlist_len(arg_chars) + (need_quotes ? 2 : 0) + 1),
-                             sizeof(char));
+  const size_t formatted_arg_len = smartlist_len(arg_chars) +
+    (need_quotes ? 2 : 0) + 1;
+  formatted_arg = tor_malloc_zero(formatted_arg_len);
 
   /* Add leading quote */
   i=0;