From 6cb47f18b54290ea4fc004b710bb958d351dcfbf Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Tue, 25 Jan 2011 00:39:07 +0100 Subject: [PATCH] Fix memory leak of operator certfp fields. --- src/newconf.c | 6 +++++- src/s_newconf.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/newconf.c b/src/newconf.c index 5991cce..2bddfce 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -628,7 +628,7 @@ conf_end_oper(struct TopConf *tc) } if(!EmptyString(yy_oper->certfp)) - yy_tmpoper->certfp = yy_oper->certfp; + yy_tmpoper->certfp = rb_strdup(yy_oper->certfp); #endif /* all is ok, put it on oper_conf_list */ @@ -652,6 +652,8 @@ conf_set_oper_flags(void *data) static void conf_set_oper_fingerprint(void *data) { + if (yy_oper->certfp) + rb_free(yy_oper->certfp); yy_oper->certfp = rb_strdup((char *) data); } @@ -1389,6 +1391,8 @@ conf_set_connect_accept_password(void *data) static void conf_set_connect_fingerprint(void *data) { + if (yy_server->certfp) + rb_free(yy_server->certfp); yy_server->certfp = rb_strdup((char *) data); /* force SSL to be enabled if fingerprint is enabled. */ diff --git a/src/s_newconf.c b/src/s_newconf.c index 6114a51..d35cef2 100644 --- a/src/s_newconf.c +++ b/src/s_newconf.c @@ -261,6 +261,7 @@ free_oper_conf(struct oper_conf *oper_p) rb_free(oper_p->username); rb_free(oper_p->host); rb_free(oper_p->name); + rb_free(oper_p->certfp); if(oper_p->passwd) {