commit 2dd47ce6624d374932f7c212b1f719ad09143c5e Author: Zack Weinberg zackw@panix.com Date: Tue Jul 19 11:56:42 2011 -0700
Fix minor memory leaks in protocol-specific option parsing and a major one in obfs2.c:digest_new. --- src/protocols/dummy.c | 2 +- src/protocols/obfs2.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/protocols/dummy.c b/src/protocols/dummy.c index c65f7b5..578182a 100644 --- a/src/protocols/dummy.c +++ b/src/protocols/dummy.c @@ -31,7 +31,7 @@ dummy_init(int n_options, const char *const *options) = xzalloc(sizeof(struct protocol_params_t));
if (parse_and_set_options(n_options, options, params) < 0) { - free(params); + proto_params_free(params); usage(); return NULL; } diff --git a/src/protocols/obfs2.c b/src/protocols/obfs2.c index 5c9aedc..6688ebf 100644 --- a/src/protocols/obfs2.c +++ b/src/protocols/obfs2.c @@ -6,6 +6,7 @@
#define PROTOCOL_OBFS2_PRIVATE #include "obfs2.h" +#include "../protocol.h"
#include <stdlib.h> #include <string.h> @@ -37,8 +38,8 @@ obfs2_init(int n_options, const char *const *options) = xzalloc(sizeof(struct protocol_params_t));
if (parse_and_set_options(n_options, options, params) < 0) { + proto_params_free(params); usage(); - free(params); return NULL; }
@@ -181,6 +182,7 @@ derive_key(void *s, const char *keytype) d = digest_new(); digest_update(d, buf, sizeof(buf)); digest_getdigest(d, buf, sizeof(buf)); + digest_free(d); } }