Fix a few crashes and leaks when cloning C strings.
authorPaul Eggert <eggert@penguin.cs.ucla.edu>
Fri, 28 Feb 2014 21:45:34 +0000 (13:45 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 28 Feb 2014 21:45:34 +0000 (13:45 -0800)
commit8268febfe0c336ff47a61d0d416fd4bebf61a993
tree4a1590e6aff922e69646cc35347192ea507b1c7a
parentb70257b07ea6053bce27b20ad0bda50f547bd393
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.
src/ChangeLog
src/alloc.c
src/gtkutil.c
src/lisp.h
src/term.c
src/xsettings.c