=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/options.c,v retrieving revision 1.18 retrieving revision 1.19 diff -c -r1.18 -r1.19 *** src/usr.bin/tmux/options.c 2016/01/19 15:59:12 1.18 --- src/usr.bin/tmux/options.c 2016/09/26 09:02:34 1.19 *************** *** 1,4 **** ! /* $OpenBSD: options.c,v 1.18 2016/01/19 15:59:12 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: options.c,v 1.19 2016/09/26 09:02:34 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott *************** *** 128,146 **** { struct options_entry *o; va_list ap; if ((o = options_find1(oo, name)) == NULL) { o = xmalloc(sizeof *o); o->name = xstrdup(name); RB_INSERT(options_tree, &oo->tree, o); memcpy(&o->style, &grid_default_cell, sizeof o->style); } else if (o->type == OPTIONS_STRING) ! free(o->str); va_start(ap, fmt); o->type = OPTIONS_STRING; xvasprintf(&o->str, fmt, ap); va_end(ap); return (o); } --- 128,150 ---- { struct options_entry *o; va_list ap; + char *s; + s = NULL; if ((o = options_find1(oo, name)) == NULL) { o = xmalloc(sizeof *o); o->name = xstrdup(name); RB_INSERT(options_tree, &oo->tree, o); memcpy(&o->style, &grid_default_cell, sizeof o->style); } else if (o->type == OPTIONS_STRING) ! s = o->str; va_start(ap, fmt); o->type = OPTIONS_STRING; xvasprintf(&o->str, fmt, ap); va_end(ap); + + free(s); return (o); }