From 92d3e512e375f9f48f30a7f201f083a700cae7c1 Mon Sep 17 00:00:00 2001 From: mk Date: Mon, 16 Jun 2008 19:09:48 +0000 Subject: Make this not crash when compiled with -g. Found by myself, analysis by kurt@, fix by me with input from otto. ``Just get some fix in...'' deraadt --- conf.c | 4 ++-- parse.y | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/conf.c b/conf.c index 69b4226..c30b3f8 100644 --- a/conf.c +++ b/conf.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: conf.c,v 1.40 2008/06/15 02:47:46 oga Exp $ + * $Id: conf.c,v 1.41 2008/06/16 19:09:48 mk Exp $ */ #include "headers.h" @@ -171,7 +171,7 @@ conf_init(struct conf *c) strlcpy(c->termpath, "xterm", sizeof(c->termpath)); strlcpy(c->lockpath, "xlock", sizeof(c->lockpath)); - c->DefaultFontName = DEFAULTFONTNAME; + c->DefaultFontName = xstrdup(DEFAULTFONTNAME); } void diff --git a/parse.y b/parse.y index c67ddbe..e80c1cb 100644 --- a/parse.y +++ b/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.12 2008/06/15 02:47:46 oga Exp $ */ +/* $OpenBSD: parse.y,v 1.13 2008/06/16 19:09:48 mk Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -100,11 +100,8 @@ yesno : YES { $$ = 1; } ; main : FONTNAME STRING { - if (conf->DefaultFontName != NULL && - conf->DefaultFontName != DEFAULTFONTNAME) - free(conf->DefaultFontName); - conf->DefaultFontName = xstrdup($2); - free($2); + free(conf->DefaultFontName); + conf->DefaultFontName = $2; } | STICKY yesno { if ($2 == 0) -- cgit v1.2.3-2-gb3c3