diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2017-06-15 21:00:58 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2017-06-25 16:35:28 +0200 |
commit | 28dcb1049bb8fdecbec6f2aadf09560077fae73e (patch) | |
tree | 7edae84cef65e2dc188fccad6102b05720cadace /src/plugins/fset | |
parent | fc1a69957354ff7908c0f22ee8d8e09c0628690c (diff) | |
download | weechat-28dcb1049bb8fdecbec6f2aadf09560077fae73e.zip |
fset: fix memory leak in allocation of fset options
Diffstat (limited to 'src/plugins/fset')
-rw-r--r-- | src/plugins/fset/fset-option.c | 20 |
1 files changed, 20 insertions, 0 deletions
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; |