X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Ftoe.c;h=06840455393d6909dc2d8286605374ea892c1292;hp=56c9d9fb7e277cf846d9201406b33d66c21cf239;hb=32f1c9b1a0fdad8ac997c7a8ac9cb92c610b4336;hpb=91fa4688e82518794fcf0c32a36f3fcca5e4c2d5 diff --git a/progs/toe.c b/progs/toe.c index 56c9d9fb..06840455 100644 --- a/progs/toe.c +++ b/progs/toe.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -44,7 +44,7 @@ #include #endif -MODULE_ID("$Id: toe.c,v 1.69 2012/10/27 20:01:20 tom Exp $") +MODULE_ID("$Id: toe.c,v 1.71 2013/03/09 22:45:23 tom Exp $") #define isDotname(name) (!strcmp(name, ".") || !strcmp(name, "..")) @@ -259,8 +259,11 @@ term_description(TERMTYPE *tp) { const char *desc; - if ((desc = strrchr(tp->term_names, '|')) == 0 || *++desc == '\0') + if (tp->term_names == 0 + || (desc = strrchr(tp->term_names, '|')) == 0 + || (*++desc == '\0')) { desc = "(No description)"; + } return desc; } @@ -437,7 +440,10 @@ typelist(int eargc, char *eargv[], (void) fprintf(stderr, "%s: couldn't open terminfo file %s.\n", _nc_progname, name_2); + free(cwd_buf); free(name_2); + closedir(entrydir); + closedir(termdir); return (EXIT_FAILURE); }