Date: Wed, 20 Jun 2001 14:30:02 -0700 (PDT) From: Mark Valentine <mark@thuvia.demon.co.uk> To: freebsd-bugs@FreeBSD.org Subject: Re: gnu/28189: [PATCH] fix for detecting empty CVS commit log message Message-ID: <200106202130.f5KLU2i65743@freefall.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR gnu/28189; it has been noted by GNATS.
From: Mark Valentine <mark@thuvia.demon.co.uk>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Re: gnu/28189: [PATCH] fix for detecting empty CVS commit log message
Date: Wed, 20 Jun 2001 22:22:26 +0100 (BST)
Here's a new patch incorporating the official fix which was checked into the
cvs cvs(!) tree; it also fixes a related memory leak.
ChangeLog entry as follows:
2001-06-20 Derek Price <dprice@collab.net>
* logmsg.c (do_editor): Abort in the case that the file has only
comment lines.
(Original patch from Mark Valentine <mark@thuvia.demon.co.uk>.)
* logmsg.c (do_editor): Fix rare memory leak.
Index: contrib/cvs/src/logmsg.c
===================================================================
RCS file: /usr/cvs/src/contrib/cvs/src/logmsg.c,v
retrieving revision 1.7
diff -u -r1.7 logmsg.c
--- contrib/cvs/src/logmsg.c 2000/10/02 06:43:56 1.7
+++ contrib/cvs/src/logmsg.c 2001/06/20 17:08:31
@@ -307,7 +307,7 @@
/* On NT, we might read less than st_size bytes, but we won't
read more. So this works. */
*messagep = (char *) xmalloc (post_stbuf.st_size + 1);
- *messagep[0] = '\0';
+ (*messagep)[0] = '\0';
}
line = NULL;
@@ -340,8 +340,14 @@
if (pre_stbuf.st_mtime == post_stbuf.st_mtime ||
*messagep == NULL ||
+ (*messagep)[0] == '\0' ||
strcmp (*messagep, "\n") == 0)
{
+ if (*messagep)
+ {
+ free (*messagep);
+ *messagep = NULL;
+ }
for (;;)
{
(void) printf ("\nLog message unchanged or not specified\n");
--
Mark Valentine, Thuvia Labs <mark@thuvia.co.uk> <http://www.thuvia.co.uk>
"Tigers will do ANYTHING for a tuna fish sandwich." Mark Valentine uses
"We're kind of stupid that way." *munch* *munch* and endorses FreeBSD
-- <http://www.calvinandhobbes.com> <http://www.freebsd.org>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106202130.f5KLU2i65743>
