Bug 28295

Summary: Re: [PATCH] fix for detecting empty CVS commit log message
Product: Base System Reporter: Mark Valentine <mark>
Component: gnuAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 1.0-RELEASE   
Hardware: Any   
OS: Any   

Description Mark Valentine 2001-06-20 18:20:00 UTC
 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>
Comment 1 greid freebsd_committer freebsd_triage 2001-07-02 19:29:03 UTC
State Changed
From-To: open->closed

Part of the audit trail of 28189 


Comment 2 greid freebsd_committer freebsd_triage 2001-07-02 19:29:03 UTC
Responsible Changed
From-To: gnats-admin->freebsd-bugs

Misfiled