0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 08:42:34 +01:00

Fix memory leak of operator certfp fields.

This commit is contained in:
Jilles Tjoelker 2011-01-25 00:39:07 +01:00
parent ed45dfe676
commit 462ae9d7a5
2 changed files with 6 additions and 1 deletions

View file

@ -597,7 +597,7 @@ conf_end_oper(struct TopConf *tc)
} }
if(!EmptyString(yy_oper->certfp)) if(!EmptyString(yy_oper->certfp))
yy_tmpoper->certfp = yy_oper->certfp; yy_tmpoper->certfp = rb_strdup(yy_oper->certfp);
#endif #endif
/* all is ok, put it on oper_conf_list */ /* all is ok, put it on oper_conf_list */
@ -621,6 +621,8 @@ conf_set_oper_flags(void *data)
static void static void
conf_set_oper_fingerprint(void *data) conf_set_oper_fingerprint(void *data)
{ {
if (yy_oper->certfp)
rb_free(yy_oper->certfp);
yy_oper->certfp = rb_strdup((char *) data); yy_oper->certfp = rb_strdup((char *) data);
} }
@ -1322,6 +1324,8 @@ conf_set_connect_accept_password(void *data)
static void static void
conf_set_connect_fingerprint(void *data) conf_set_connect_fingerprint(void *data)
{ {
if (yy_server->certfp)
rb_free(yy_server->certfp);
yy_server->certfp = rb_strdup((char *) data); yy_server->certfp = rb_strdup((char *) data);
/* force SSL to be enabled if fingerprint is enabled. */ /* force SSL to be enabled if fingerprint is enabled. */

View file

@ -262,6 +262,7 @@ free_oper_conf(struct oper_conf *oper_p)
rb_free(oper_p->username); rb_free(oper_p->username);
rb_free(oper_p->host); rb_free(oper_p->host);
rb_free(oper_p->name); rb_free(oper_p->name);
rb_free(oper_p->certfp);
if(oper_p->passwd) if(oper_p->passwd)
{ {