[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r16776: {tor} Fix a memory leak in tor-gencert.c (tor/trunk/src/tools)



Author: nickm
Date: 2008-09-05 15:55:04 -0400 (Fri, 05 Sep 2008)
New Revision: 16776

Modified:
   tor/trunk/src/tools/tor-gencert.c
Log:
Fix a memory leak in tor-gencert.c

Modified: tor/trunk/src/tools/tor-gencert.c
===================================================================
--- tor/trunk/src/tools/tor-gencert.c	2008-09-05 19:52:44 UTC (rev 16775)
+++ tor/trunk/src/tools/tor-gencert.c	2008-09-05 19:55:04 UTC (rev 16776)
@@ -124,7 +124,7 @@
 parse_commandline(int argc, char **argv)
 {
   int i;
-  log_severity_list_t *s;
+  log_severity_list_t s;
   for (i = 1; i < argc; ++i) {
     if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
       show_help();
@@ -190,12 +190,12 @@
     }
   }
 
-  s = tor_malloc_zero(sizeof(log_severity_list_t));
+  memset(&s, 0, sizeof(s));
   if (verbose)
-    set_log_severity_config(LOG_DEBUG, LOG_ERR, s);
+    set_log_severity_config(LOG_DEBUG, LOG_ERR, &s);
   else
-    set_log_severity_config(LOG_WARN, LOG_ERR, s);
-  add_stream_log(s, "<stderr>", stderr);
+    set_log_severity_config(LOG_WARN, LOG_ERR, &s);
+  add_stream_log(&s, "<stderr>", stderr);
 
   if (!identity_key_file) {
     identity_key_file = tor_strdup("./authority_identity_key");