Magellan Linux

Contents of /trunk/ncurses/patches/ncurses-5.6-coverity.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 714 - (show annotations) (download)
Mon Dec 22 10:42:02 2008 UTC (15 years, 4 months ago) by niro
File size: 17546 byte(s)
added several ncurses patches

1 # patch by Thomas E. Dickey <dickey@invisible-island.net>
2 # created Sat Apr 7 16:56:37 UTC 2007
3 # ------------------------------------------------------------------------------
4 # NEWS | 30 ++++++++++++++++++++++++++++++
5 # c++/cursesmain.cc | 19 +++++++++++++++++++
6 # c++/cursesp.h | 2 +-
7 # c++/etip.h.in | 20 +++++++++++++++-----
8 # configure | 2 +-
9 # configure.in | 2 +-
10 # include/ncurses_defs | 1 +
11 # ncurses/base/lib_addstr.c | 5 +++--
12 # ncurses/base/lib_color.c | 9 ++++++---
13 # ncurses/base/lib_overlay.c | 7 +++++--
14 # ncurses/base/tries.c | 2 +-
15 # ncurses/base/wresize.c | 2 +-
16 # ncurses/tinfo/trim_sgr0.c | 6 ++----
17 # progs/dump_entry.c | 13 ++++++++-----
18 # progs/infocmp.c | 1 -
19 # progs/tic.c | 32 +++++++++++++++++++++++++-------
20 # tack/ansi.c | 7 +++++--
21 # tack/output.c | 6 ++++--
22 # test/bs.c | 2 +-
23 # test/cardfile.c | 6 ++++--
24 # test/demo_defkey.c | 3 +--
25 # 21 files changed, 134 insertions(+), 43 deletions(-)
26 # ------------------------------------------------------------------------------
27 Index: NEWS
28 Prereq: 1.1056
29 --- ncurses-5.6+/NEWS 2006-12-17 20:36:26.000000000 +0000
30 +++ ncurses-5.6-coverity/NEWS 2007-04-07 16:55:45.000000000 +0000
31 @@ -45,6 +45,36 @@
32 Changes through 1.9.9e did not credit all contributions;
33 it is not possible to add this information.
34
35 +20060407
36 + > other fixes prompted by inspection for Coverity report:
37 + + modify ifdef's for c++ binding to use try/catch/throw statements
38 + + add a null-pointer check in tack/ansi.c request_cfss()
39 + + fix a memory leak in ncurses/base/wresize.c
40 + + corrected check for valid memu/meml capabilities in
41 + progs/dump_entry.c when handling V_HPUX case.
42 + > fixes based on Coverity report:
43 + + remove dead code in test/bs.c
44 + + remove dead code in test/demo_defkey.c
45 + + remove an unused assignment in progs/infocmp.c
46 + + fix a limit check in tack/ansi.c tools_charset()
47 + + fix tack/ansi.c tools_status() to perform the VT320/VT420
48 + tests in request_cfss(). The function had exited too soon.
49 + + fix a memory leak in tic.c's make_namelist()
50 + + fix a couple of places in tack/output.c which did not check for EOF.
51 + + fix a loop-condition in test/bs.c
52 + + add index checks in lib_color.c for color palettes
53 + + add index checks in progs/dump_entry.c for version_filter() handling
54 + of V_BSD case.
55 + + fix a possible null-pointer dereference in copywin()
56 + + fix a possible null-pointer dereference in waddchnstr()
57 + + add a null-pointer check in _nc_expand_try()
58 + + add a null-pointer check in tic.c's make_namelist()
59 + + add a null-pointer check in _nc_expand_try()
60 + + add null-pointer checks in test/cardfile.c
61 + + fix a double-free in ncurses/tinfo/trim_sgr0.c
62 + + fix a double-free in ncurses/base/wresize.c
63 + + add try/catch block to c++/cursesmain.cc
64 +
65 20061217 5.6 release for upload to ftp.gnu.org
66
67 20061217
68 Index: c++/cursesmain.cc
69 Prereq: 1.11
70 --- ncurses-5.6+/c++/cursesmain.cc 2003-10-25 14:53:13.000000000 +0000
71 +++ ncurses-5.6-coverity/c++/cursesmain.cc 2007-04-07 00:56:43.000000000 +0000
72 @@ -34,6 +34,13 @@
73 #include "internal.h"
74 #include "cursesapp.h"
75
76 +#if CPP_HAS_TRY_CATCH && HAVE_IOSTREAM
77 +#include <iostream>
78 +#else
79 +#undef CPP_HAS_TRY_CATCH
80 +#define CPP_HAS_TRY_CATCH 0
81 +#endif
82 +
83 MODULE_ID("$Id: ncurses-5.6-coverity.patch,v 1.1 2008-12-22 10:40:02 niro Exp $")
84
85 #if HAVE_LOCALE_H
86 @@ -58,8 +65,20 @@
87
88 A->handleArgs(argc,argv);
89 ::endwin();
90 +#if CPP_HAS_TRY_CATCH
91 + try {
92 + res = (*A)();
93 + ::endwin();
94 + }
95 + catch(const NCursesException &e) {
96 + ::endwin();
97 + std::cerr << e.message << std::endl;
98 + res = e.errorno;
99 + }
100 +#else
101 res = (*A)();
102 ::endwin();
103 +#endif
104 return(res);
105 }
106 }
107 Index: c++/cursesp.h
108 Prereq: 1.26
109 --- ncurses-5.6+/c++/cursesp.h 2005-08-13 18:09:21.000000000 +0000
110 +++ ncurses-5.6-coverity/c++/cursesp.h 2007-04-07 00:47:22.000000000 +0000
111 @@ -83,7 +83,7 @@
112 return uptr->m_user;
113 }
114
115 - void OnError (int err) const THROWS((NCursesPanelException))
116 + void OnError (int err) const THROWS(NCursesPanelException)
117 {
118 if (err==ERR)
119 THROW(new NCursesPanelException (this, err));
120 Index: c++/etip.h.in
121 Prereq: 1.32
122 --- ncurses-5.6+/c++/etip.h.in 2005-08-06 19:55:57.000000000 +0000
123 +++ ncurses-5.6-coverity/c++/etip.h.in 2007-04-07 00:49:39.000000000 +0000
124 @@ -342,23 +342,33 @@
125 inline void THROW(const NCursesException *e) {
126 #if defined(__GNUG__) && defined(__EXCEPTIONS)
127 # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
128 - (*lib_error_handler)(e?e->classname():"",e?e->message:"");
129 + (*lib_error_handler)(e ? e->classname() : "", e ? e->message : "");
130 #else
131 - throw *e;
132 +#define CPP_HAS_TRY_CATCH 1
133 #endif
134 #elif defined(__SUNPRO_CC)
135 # if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5)
136 genericerror(1, ((e != 0) ? (char *)(e->message) : ""));
137 #else
138 - throw *e;
139 +#define CPP_HAS_TRY_CATCH 1
140 #endif
141 #else
142 if (e)
143 cerr << e->message << endl;
144 exit(0);
145 #endif
146 -}
147
148 -#define THROWS(s)
149 +#ifndef CPP_HAS_TRY_CATCH
150 +#define CPP_HAS_TRY_CATCH 0
151 +#define NCURSES_CPP_TRY /* nothing */
152 +#define NCURSES_CPP_CATCH(e) if (false)
153 +#define THROWS(s) /* nothing */
154 +#elif CPP_HAS_TRY_CATCH
155 + throw *e;
156 +#define NCURSES_CPP_TRY try
157 +#define NCURSES_CPP_CATCH(e) catch(e)
158 +#define THROWS(s) throw(s)
159 +#endif
160 +}
161
162 #endif /* NCURSES_ETIP_H_incl */
163 Index: configure
164 --- ncurses-5.6+/configure 2006-12-17 16:33:38.000000000 +0000
165 +++ ncurses-5.6-coverity/configure 2007-04-06 22:54:52.000000000 +0000
166 @@ -13865,7 +13865,7 @@
167 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
168 ac_main_return=return
169
170 -for ac_header in typeinfo
171 +for ac_header in iostream typeinfo
172 do
173 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
174 echo "$as_me:13871: checking for $ac_header" >&5
175 Index: configure.in
176 Prereq: 1.383
177 --- ncurses-5.6+/configure.in 2006-12-17 01:26:06.000000000 +0000
178 +++ ncurses-5.6-coverity/configure.in 2007-04-06 22:53:21.000000000 +0000
179 @@ -1200,7 +1200,7 @@
180 ;;
181 esac
182
183 - AC_CHECK_HEADERS(typeinfo)
184 + AC_CHECK_HEADERS(iostream typeinfo)
185
186 CF_BOOL_DECL
187 CF_BOOL_SIZE
188 Index: include/ncurses_defs
189 Prereq: 1.30
190 --- ncurses-5.6+/include/ncurses_defs 2006-08-05 19:27:02.000000000 +0000
191 +++ ncurses-5.6-coverity/include/ncurses_defs 2007-04-06 22:54:16.000000000 +0000
192 @@ -68,6 +68,7 @@
193 HAVE_GPP_BUILTIN_H
194 HAVE_GXX_BUILTIN_H
195 HAVE_HAS_KEY
196 +HAVE_IOSTREAM
197 HAVE_ISASCII
198 HAVE_ISSETUGID
199 HAVE_LANGINFO_CODESET
200 Index: ncurses/base/lib_addstr.c
201 Prereq: 1.46
202 --- ncurses-5.6+/ncurses/base/lib_addstr.c 2006-05-27 19:22:19.000000000 +0000
203 +++ ncurses-5.6-coverity/ncurses/base/lib_addstr.c 2007-04-04 00:41:25.000000000 +0000
204 @@ -80,8 +80,7 @@
205 NCURSES_EXPORT(int)
206 waddchnstr(WINDOW *win, const chtype *astr, int n)
207 {
208 - NCURSES_SIZE_T y = win->_cury;
209 - NCURSES_SIZE_T x = win->_curx;
210 + NCURSES_SIZE_T y, x;
211 int code = OK;
212 int i;
213 struct ldat *line;
214 @@ -91,6 +90,8 @@
215 if (!win)
216 returnCode(ERR);
217
218 + y = win->_cury;
219 + x = win->_curx;
220 if (n < 0) {
221 const chtype *str;
222 n = 0;
223 Index: ncurses/base/lib_color.c
224 Prereq: 1.80
225 --- ncurses-5.6+/ncurses/base/lib_color.c 2006-11-26 01:33:16.000000000 +0000
226 +++ ncurses-5.6-coverity/ncurses/base/lib_color.c 2007-04-04 20:32:04.000000000 +0000
227 @@ -56,7 +56,10 @@
228
229 #define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
230
231 +#define MAX_PALETTE 8
232 +
233 #define OkColorHi(n) (((n) < COLORS) && ((n) < max_colors))
234 +#define InPalette(n) ((n) >= 0 && (n) < MAX_PALETTE)
235
236 /*
237 * Given a RGB range of 0..1000, we'll normally set the individual values
238 @@ -162,10 +165,10 @@
239
240 tp = (hue_lightness_saturation) ? hls_palette : cga_palette;
241 for (n = 0; n < COLORS; n++) {
242 - if (n < 8) {
243 + if (InPalette(n)) {
244 SP->_color_table[n] = tp[n];
245 } else {
246 - SP->_color_table[n] = tp[n % 8];
247 + SP->_color_table[n] = tp[n % MAX_PALETTE];
248 if (hue_lightness_saturation) {
249 SP->_color_table[n].green = 100;
250 } else {
251 @@ -365,7 +368,7 @@
252 if (GET_SCREEN_PAIR(SP) == pair)
253 SET_SCREEN_PAIR(SP, (chtype) (~0)); /* force attribute update */
254
255 - if (initialize_pair) {
256 + if (initialize_pair && InPalette(f) && InPalette(b)) {
257 const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette;
258
259 T(("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)",
260 Index: ncurses/base/lib_overlay.c
261 Prereq: 1.22
262 --- ncurses-5.6+/ncurses/base/lib_overlay.c 2006-10-14 20:43:31.000000000 +0000
263 +++ ncurses-5.6-coverity/ncurses/base/lib_overlay.c 2007-04-04 00:40:12.000000000 +0000
264 @@ -139,8 +139,8 @@
265 {
266 int sx, sy, dx, dy;
267 bool touched;
268 - attr_t bk = AttrOf(dst->_nc_bkgd);
269 - attr_t mask = ~(attr_t) ((bk & A_COLOR) ? A_COLOR : 0);
270 + attr_t bk;
271 + attr_t mask;
272
273 T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"),
274 src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over));
275 @@ -148,6 +148,9 @@
276 if (!src || !dst)
277 returnCode(ERR);
278
279 + bk = AttrOf(dst->_nc_bkgd);
280 + mask = ~(attr_t) ((bk & A_COLOR) ? A_COLOR : 0);
281 +
282 /* make sure rectangle exists in source */
283 if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) ||
284 (smincol + dmaxcol - dmincol) > (src->_maxx + 1)) {
285 Index: ncurses/base/tries.c
286 Prereq: 1.22
287 --- ncurses-5.6+/ncurses/base/tries.c 2005-11-26 20:09:18.000000000 +0000
288 +++ ncurses-5.6-coverity/ncurses/base/tries.c 2007-04-03 20:58:30.000000000 +0000
289 @@ -68,7 +68,7 @@
290 }
291 }
292 if (result != 0) {
293 - if ((result[len] = ptr->ch) == 0)
294 + if (ptr != 0 && (result[len] = ptr->ch) == 0)
295 *((unsigned char *) (result + len)) = 128;
296 #ifdef TRACE
297 if (len == 0 && _nc_tracing != 0)
298 Index: ncurses/base/wresize.c
299 Prereq: 1.24
300 --- ncurses-5.6+/ncurses/base/wresize.c 2006-10-14 20:43:31.000000000 +0000
301 +++ ncurses-5.6-coverity/ncurses/base/wresize.c 2007-04-04 20:28:42.000000000 +0000
302 @@ -38,7 +38,7 @@
303 cleanup_lines(struct ldat *data, int length)
304 {
305 while (--length >= 0)
306 - free(data->text);
307 + free(data[length].text);
308 free(data);
309 return ERR;
310 }
311 Index: ncurses/tinfo/trim_sgr0.c
312 Prereq: 1.7
313 --- ncurses-5.6+/ncurses/tinfo/trim_sgr0.c 2006-12-02 19:37:57.000000000 +0000
314 +++ ncurses-5.6-coverity/ncurses/tinfo/trim_sgr0.c 2007-04-04 19:29:01.000000000 +0000
315 @@ -247,9 +247,7 @@
316 if (!rewrite_sgr(on, enter_alt_charset_mode)
317 || !rewrite_sgr(off, exit_alt_charset_mode)
318 || !rewrite_sgr(end, exit_alt_charset_mode)) {
319 - FreeIfNeeded(on);
320 FreeIfNeeded(off);
321 - FreeIfNeeded(end);
322 } else if (similar_sgr(off, end)
323 && !similar_sgr(off, on)) {
324 TR(TRACE_DATABASE, ("adjusting sgr(9:off) : %s", _nc_visbuf(off)));
325 @@ -315,8 +313,8 @@
326 */
327 free(off);
328 }
329 - free(end);
330 - free(on);
331 + FreeIfNeeded(end);
332 + FreeIfNeeded(on);
333 } else {
334 /*
335 * Possibly some applications are confused if sgr0 contains rmacs,
336 Index: progs/dump_entry.c
337 Prereq: 1.79
338 --- ncurses-5.6+/progs/dump_entry.c 2006-09-30 20:18:15.000000000 +0000
339 +++ ncurses-5.6-coverity/progs/dump_entry.c 2007-04-07 15:51:47.000000000 +0000
340 @@ -352,14 +352,17 @@
341 }
342 break;
343
344 +#define is_termcap(type) (idx < (int) sizeof(type##_from_termcap) && \
345 + type##_from_termcap[idx])
346 +
347 case V_BSD: /* BSD */
348 switch (type) {
349 case BOOLEAN:
350 - return bool_from_termcap[idx];
351 + return is_termcap(bool);
352 case NUMBER:
353 - return num_from_termcap[idx];
354 + return is_termcap(num);
355 case STRING:
356 - return str_from_termcap[idx];
357 + return is_termcap(str);
358 }
359 break;
360 }
361 @@ -788,11 +791,11 @@
362 * Much more work should be done on this to support dumping termcaps.
363 */
364 if (tversion == V_HPUX) {
365 - if (memory_lock) {
366 + if (VALID_STRING(memory_lock)) {
367 (void) sprintf(buffer, "meml=%s", memory_lock);
368 WRAP_CONCAT;
369 }
370 - if (memory_unlock) {
371 + if (VALID_STRING(memory_unlock)) {
372 (void) sprintf(buffer, "memu=%s", memory_unlock);
373 WRAP_CONCAT;
374 }
375 Index: progs/infocmp.c
376 Prereq: 1.85
377 --- ncurses-5.6+/progs/infocmp.c 2006-08-19 21:20:37.000000000 +0000
378 +++ ncurses-5.6-coverity/progs/infocmp.c 2007-04-04 00:51:49.000000000 +0000
379 @@ -1083,7 +1083,6 @@
380 }
381 *tp++ = '"';
382 *tp = '\0';
383 - size += (strlen(term->Strings[n]) + 1);
384 (void) printf("static char %-20s[] = %s;\n",
385 string_variable(ExtStrname(term, n, strnames)), buf);
386 }
387 Index: progs/tic.c
388 Prereq: 1.131
389 --- ncurses-5.6+/progs/tic.c 2006-12-02 22:13:17.000000000 +0000
390 +++ ncurses-5.6-coverity/progs/tic.c 2007-04-07 15:20:35.000000000 +0000
391 @@ -353,11 +353,24 @@
392 return fp;
393 }
394
395 +#if NO_LEAKS
396 +static void
397 +free_namelist(char **src)
398 +{
399 + if (src != 0) {
400 + int n;
401 + for (n = 0; src[n] != 0; ++n)
402 + free (src[n]);
403 + free (src);
404 + }
405 +}
406 +#endif
407 +
408 /* Parse the "-e" option-value into a list of names */
409 -static const char **
410 +static char **
411 make_namelist(char *src)
412 {
413 - const char **dst = 0;
414 + char **dst = 0;
415
416 char *s, *base;
417 unsigned pass, n, nn;
418 @@ -374,11 +387,13 @@
419 if ((s = stripped(buffer)) != 0) {
420 if (dst != 0)
421 dst[nn] = s;
422 + else
423 + free(s);
424 nn++;
425 }
426 }
427 if (pass == 1) {
428 - dst = typeCalloc(const char *, nn + 1);
429 + dst = typeCalloc(char *, nn + 1);
430 rewind(fp);
431 }
432 }
433 @@ -401,10 +416,10 @@
434 break;
435 }
436 if (pass == 1)
437 - dst = typeCalloc(const char *, nn + 1);
438 + dst = typeCalloc(char *, nn + 1);
439 }
440 }
441 - if (showsummary) {
442 + if (showsummary && (dst != 0)) {
443 fprintf(log_fp, "Entries that will be compiled:\n");
444 for (n = 0; dst[n] != 0; n++)
445 fprintf(log_fp, "%u:%s\n", n + 1, dst[n]);
446 @@ -413,7 +428,7 @@
447 }
448
449 static bool
450 -matches(const char **needle, const char *haystack)
451 +matches(char **needle, const char *haystack)
452 /* does entry in needle list match |-separated field in haystack? */
453 {
454 bool code = FALSE;
455 @@ -468,7 +483,7 @@
456 bool limited = TRUE;
457 char *tversion = (char *) NULL;
458 const char *source_file = "terminfo";
459 - const char **namelst = 0;
460 + char **namelst = 0;
461 char *outdir = (char *) NULL;
462 bool check_only = FALSE;
463 bool suppress_untranslatable = FALSE;
464 @@ -784,6 +799,9 @@
465 else
466 fprintf(log_fp, "No entries written\n");
467 }
468 +#if NO_LEAKS
469 + free_namelist(namelst);
470 +#endif
471 cleanup();
472 ExitProgram(EXIT_SUCCESS);
473 }
474 Index: tack/ansi.c
475 Prereq: 1.10
476 --- ncurses-5.6+/tack/ansi.c 2005-09-17 19:49:16.000000000 +0000
477 +++ ncurses-5.6-coverity/tack/ansi.c 2007-04-07 14:49:53.000000000 +0000
478 @@ -309,6 +309,8 @@
479 put_crlf();
480 for (i = 0; rqss[i].text; i++) {
481 ptext(rqss[i].text);
482 + if (rqss[i].expect == 0)
483 + continue;
484 j = strlen(rqss[i].text) + strlen(rqss[i].expect);
485 putchp(' ');
486 for (j++; j < 40; j++)
487 @@ -600,10 +602,11 @@
488 i = read_reports();
489 if (i != 'r' && i != 'R') {
490 *ch = i;
491 - return;
492 + break;
493 }
494 } while (i);
495
496 + /* VT320, VT420, etc. */
497 if (terminal_class >= 63) {
498 do {
499 i = request_cfss();
500 @@ -841,7 +844,7 @@
501 bank[j] = ch;
502 if (ch < ' ' || ch > '/')
503 break;
504 - if (j + 1 >= (int) sizeof(bank))
505 + if (j + 2 >= (int) sizeof(bank))
506 break;
507 }
508 if (j == 1)
509 Index: tack/output.c
510 Prereq: 1.11
511 --- ncurses-5.6+/tack/output.c 2006-11-26 00:16:49.000000000 +0000
512 +++ ncurses-5.6-coverity/tack/output.c 2007-04-07 14:39:05.000000000 +0000
513 @@ -740,7 +740,9 @@
514 /* ignore control S, but tell me about it */
515 while (ch == 023 || ch == 021) {
516 ch = getchp(STRIP_PARITY);
517 - if (i < (int) sizeof(cc))
518 + if (ch == EOF)
519 + break;
520 + if (i + 1 < (int) sizeof(cc))
521 cc[++i] = ch;
522 }
523 put_str("\nThe terminal sent a ^S -");
524 @@ -778,7 +780,7 @@
525
526 for (i = 0; i < length - 1; ) {
527 ch = getchp(STRIP_PARITY);
528 - if (ch == '\r' || ch == '\n') {
529 + if (ch == '\r' || ch == '\n' || ch == EOF) {
530 break;
531 }
532 if (ch == '\b' || ch == 127) {
533 Index: test/bs.c
534 Prereq: 1.44
535 --- ncurses-5.6+/test/bs.c 2006-05-20 15:38:52.000000000 +0000
536 +++ ncurses-5.6-coverity/test/bs.c 2007-04-02 23:14:05.000000000 +0000
537 @@ -459,7 +459,7 @@
538 do {
539 c = getch();
540 } while
541 - (!strchr("hjklrR", c) || c == FF);
542 + (!(strchr("hjklrR", c) || c == FF));
543
544 if (c == FF) {
545 (void) clearok(stdscr, TRUE);
546 Index: test/cardfile.c
547 Prereq: 1.28
548 --- ncurses-5.6+/test/cardfile.c 2006-12-10 00:30:09.000000000 +0000
549 +++ ncurses-5.6-coverity/test/cardfile.c 2007-04-04 20:12:24.000000000 +0000
550 @@ -136,13 +136,15 @@
551 if ((offset = strlen(card->content)) != 0) {
552 total += 1 + offset;
553 card->content = (char *) realloc(card->content, total + 1);
554 - strcpy(card->content + offset++, " ");
555 + if (card->content)
556 + strcpy(card->content + offset++, " ");
557 } else {
558 if (card->content != 0)
559 free(card->content);
560 card->content = (char *) malloc(total + 1);
561 }
562 - strcpy(card->content + offset, content);
563 + if (card->content)
564 + strcpy(card->content + offset, content);
565 }
566 }
567
568 Index: test/demo_defkey.c
569 Prereq: 1.16
570 --- ncurses-5.6+/test/demo_defkey.c 2006-04-01 19:08:03.000000000 +0000
571 +++ ncurses-5.6-coverity/test/demo_defkey.c 2007-04-02 23:17:56.000000000 +0000
572 @@ -143,13 +143,12 @@
573 code_name);
574 }
575 log_last_line(win);
576 +
577 if (vis_string != 0) {
578 free(vis_string);
579 vis_string = 0;
580 }
581
582 - if (vis_string != 0)
583 - free(vis_string);
584 vis_string = visible(new_string);
585 if ((rc = key_defined(new_string)) > 0) {
586 wprintw(win, "%s was bound to %s\n", vis_string, keyname(rc));