diff options
| author | Paul Eggert | 2014-02-28 13:45:34 -0800 |
|---|---|---|
| committer | Paul Eggert | 2014-02-28 13:45:34 -0800 |
| commit | 8268febfe0c336ff47a61d0d416fd4bebf61a993 (patch) | |
| tree | 4a1590e6aff922e69646cc35347192ea507b1c7a /src/gtkutil.c | |
| parent | b70257b07ea6053bce27b20ad0bda50f547bd393 (diff) | |
| download | emacs-8268febfe0c336ff47a61d0d416fd4bebf61a993.tar.gz emacs-8268febfe0c336ff47a61d0d416fd4bebf61a993.zip | |
Fix a few crashes and leaks when cloning C strings.
* alloc.c, lisp.h (dupstring): New function.
* gtkutil.c (xg_get_font):
* term.c (tty_default_color_capabilities):
* xsettings.c (store_monospaced_changed)
(store_font_name_changed, parse_settings)
(read_and_apply_settings, init_gsettings, init_gconf): Use it.
This avoids some unlikely crashes due to accessing freed storage,
and avoids some minor memory leaks in the more-typical case.
Diffstat (limited to 'src/gtkutil.c')
| -rw-r--r-- | src/gtkutil.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index 6e039c7a141..cebff68614f 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -2106,8 +2106,7 @@ xg_get_font (struct frame *f, const char *default_name) | |||
| 2106 | font = Ffont_spec (8, args); | 2106 | font = Ffont_spec (8, args); |
| 2107 | 2107 | ||
| 2108 | pango_font_description_free (desc); | 2108 | pango_font_description_free (desc); |
| 2109 | xfree (x_last_font_name); | 2109 | dupstring (&x_last_font_name, name); |
| 2110 | x_last_font_name = xstrdup (name); | ||
| 2111 | } | 2110 | } |
| 2112 | 2111 | ||
| 2113 | #else /* Use old font selector, which just returns the font name. */ | 2112 | #else /* Use old font selector, which just returns the font name. */ |