=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/man_term.c,v retrieving revision 1.19 retrieving revision 1.20 diff -c -r1.19 -r1.20 *** src/usr.bin/mandoc/man_term.c 2009/10/27 21:40:07 1.19 --- src/usr.bin/mandoc/man_term.c 2009/12/22 23:58:00 1.20 *************** *** 1,4 **** ! /* $Id: man_term.c,v 1.19 2009/10/27 21:40:07 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * --- 1,4 ---- ! /* $Id: man_term.c,v 1.20 2009/12/22 23:58:00 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * *************** *** 18,24 **** #include #include - #include #include #include #include --- 18,23 ---- *************** *** 934,959 **** static void ! print_man_head(struct termp *p, const struct man_meta *meta) { ! char *buf, *title; p->rmargin = p->maxrmargin; p->offset = 0; ! if (NULL == (buf = malloc(p->rmargin))) ! err(EXIT_FAILURE, "malloc"); ! if (NULL == (title = malloc(p->rmargin))) ! err(EXIT_FAILURE, "malloc"); ! if (meta->vol) ! (void)strlcpy(buf, meta->vol, p->rmargin); ! else ! *buf = 0; - (void)snprintf(title, p->rmargin, "%s(%d)", - meta->title, meta->msec); - p->offset = 0; p->rmargin = (p->maxrmargin - strlen(buf) + 1) / 2; p->flags |= TERMP_NOBREAK | TERMP_NOSPACE; --- 933,951 ---- static void ! print_man_head(struct termp *p, const struct man_meta *m) { ! char buf[BUFSIZ], title[BUFSIZ]; p->rmargin = p->maxrmargin; p->offset = 0; + buf[0] = title[0] = '\0'; ! if (m->vol) ! strlcpy(buf, m->vol, BUFSIZ); ! snprintf(title, BUFSIZ, "%s(%d)", m->title, m->msec); p->offset = 0; p->rmargin = (p->maxrmargin - strlen(buf) + 1) / 2; p->flags |= TERMP_NOBREAK | TERMP_NOSPACE; *************** *** 979,986 **** p->rmargin = p->maxrmargin; p->offset = 0; p->flags &= ~TERMP_NOSPACE; - - free(title); - free(buf); } - --- 971,974 ----