From a9eed33111173d9f7c7fbff74ab1573c4c12e634 Mon Sep 17 00:00:00 2001
From: Nick Mathewson <nickm@torproject.org>
Date: Tue, 14 Aug 2012 03:06:47 -0400
Subject: [PATCH] Fix memory leak in dirvote_create_microdescriptor

Found by George, who gets a cookie.
---
 src/or/dirvote.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index dc1ba7e8c4..a7fea0a75e 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -3515,7 +3515,7 @@ dirvote_create_microdescriptor(const routerinfo_t *ri)
   char *key = NULL, *summary = NULL, *family = NULL;
   size_t keylen;
   smartlist_t *chunks = smartlist_new();
-  char *output;
+  char *output = NULL;
 
   if (crypto_pk_write_public_key_to_string(ri->onion_pkey, &key, &keylen)<0)
     goto done;
@@ -3547,6 +3547,7 @@ dirvote_create_microdescriptor(const routerinfo_t *ri)
   }
 
  done:
+  tor_free(output);
   tor_free(key);
   tor_free(summary);
   tor_free(family);
-- 
GitLab