No, the space required for a string is strlen() _plus_ one... Oops.

This commit is contained in:
Tim Vanderhoek 1999-06-04 19:35:22 +00:00
parent e650b8f451
commit c5b52d6d9d

View File

@ -39,7 +39,7 @@ static char sccsid[] = "@(#)tags.c 8.1 (Berkeley) 6/6/93";
#ifndef lint
static const char rcsid[] =
"$Id$";
"$Id: tags.c,v 1.4 1999/06/01 20:02:30 hoek Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -412,8 +412,7 @@ findgtag(tag)
error("malloc() failed");
return (NULL);
}
gtag_p1->file = file;
gtag_p1->file = malloc(strlen(file));
gtag_p1->file = malloc(strlen(file) + 1);
if (!gtag_p1->file) {
pclose(fp);
error("malloc() failed");