From eff16e834b409fbd46087b303a4982b4f8b3fefa Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Sun, 23 Mar 2014 00:42:18 -0400 Subject: [PATCH] Stop leaking 'sig' at each call of router_append_dirobj_signature() The refactoring in commit cb75519b (tor 0.2.4.13-alpha) introduced this leak. --- src/or/routerparse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 3aa4bdf8a5..a6ba669671 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -728,7 +728,7 @@ router_get_dirobj_signature(const char *digest, /** Helper: used to generate signatures for routers, directories and * network-status objects. Given a digest in digest and a secret - * private_key, generate an PKCS1-padded signature, BASE64-encode it, + * private_key, generate a PKCS1-padded signature, BASE64-encode it, * surround it with -----BEGIN/END----- pairs, and write it to the * buf_len-byte buffer at buf. Return 0 on success, -1 on * failure. @@ -751,6 +751,7 @@ router_append_dirobj_signature(char *buf, size_t buf_len, const char *digest, return -1; } memcpy(buf+s_len, sig, sig_len+1); + tor_free(sig); return 0; }