projects
/
browser-switch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make sure we don't try to free a random element of cfg in set_config_value()
[browser-switch]
/
config-ui
/
browser-switchboard-config.c
diff --git
a/config-ui/browser-switchboard-config.c
b/config-ui/browser-switchboard-config.c
index
e42c564
..
c28b743
100644
(file)
--- a/
config-ui/browser-switchboard-config.c
+++ b/
config-ui/browser-switchboard-config.c
@@
-123,10
+123,6
@@
static int set_config_value(char *name, char *value) {
i = optinfo - swb_config_options;
switch (optinfo->type) {
case SWB_CONFIG_OPT_STRING:
i = optinfo - swb_config_options;
switch (optinfo->type) {
case SWB_CONFIG_OPT_STRING:
- /* Free any existing string */
- if (cfg.flags & optinfo->set_mask)
- free(*(char **)cfg.entries[i]);
-
if (strlen(value) == 0) {
/* If the new value is empty, clear the config
setting */
if (strlen(value) == 0) {
/* If the new value is empty, clear the config
setting */
@@
-164,7
+160,11
@@
static int set_config_value(char *name, char *value) {
swb_reconfig(&orig_cfg, &cfg);
swb_config_free(&orig_cfg);
swb_reconfig(&orig_cfg, &cfg);
swb_config_free(&orig_cfg);
- swb_config_free(&cfg);
+ /* XXX can't free all of cfg, it contains pointers to memory we just
+ freed above
+ swb_config_free(&cfg); */
+ if (optinfo->name && optinfo->type == SWB_CONFIG_OPT_STRING)
+ free(*(char **)cfg.entries[i]);
return retval;
}
return retval;
}