From 28dcb1049bb8fdecbec6f2aadf09560077fae73e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 15 Jun 2017 21:00:58 +0200 Subject: [PATCH] fset: fix memory leak in allocation of fset options --- src/plugins/fset/fset-option.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c index fb6b929fa..59dc543a7 100644 --- a/src/plugins/fset/fset-option.c +++ b/src/plugins/fset/fset-option.c @@ -373,18 +373,38 @@ fset_option_set_values (struct t_fset_option *fset_option, char str_value[64]; /* file */ + if (fset_option->file) + { + free (fset_option->file); + fset_option->file = NULL; + } ptr_config_name = weechat_config_option_get_string (option, "config_name"); fset_option->file = strdup (ptr_config_name); /* section */ + if (fset_option->section) + { + free (fset_option->section); + fset_option->section = NULL; + } ptr_section_name = weechat_config_option_get_string (option, "section_name"); fset_option->section = strdup (ptr_section_name); /* option */ + if (fset_option->option) + { + free (fset_option->option); + fset_option->option = NULL; + } ptr_option_name = weechat_config_option_get_string (option, "name"); fset_option->option = strdup (ptr_option_name); /* name */ + if (fset_option->name) + { + free (fset_option->name); + fset_option->name = NULL; + } length = strlen (ptr_config_name) + 1 + strlen (ptr_section_name) + 1 + strlen (ptr_option_name) + 1;