From mark@thuvia.demon.co.uk  Wed Jun 20 10:19:48 2001
Return-Path: <mark@thuvia.demon.co.uk>
Received: from phaidor.thuvia.org (thuvia.demon.co.uk [193.237.34.248])
	by hub.freebsd.org (Postfix) with ESMTP id 8E87437B403
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 20 Jun 2001 10:19:46 -0700 (PDT)
	(envelope-from mark@thuvia.demon.co.uk)
Received: from dotar-sojat.thuvia.org (dotar-sojat.thuvia.org [10.0.0.4])
	by phaidor.thuvia.org (8.11.3/8.11.3) with ESMTP id f5KHJwS18960
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 20 Jun 2001 18:19:58 +0100 (BST)
	(envelope-from mark@dotar-sojat.thuvia.org)
Received: (from mark@localhost)
	by dotar-sojat.thuvia.org (8.11.4/8.11.4) id f5KHJnW62191
	for FreeBSD-gnats-submit@freebsd.org; Wed, 20 Jun 2001 18:19:49 +0100 (BST)
	(envelope-from mark)
Message-Id: <200106201719.f5KHJnW62191@dotar-sojat.thuvia.org>
Date: Wed, 20 Jun 2001 18:19:49 +0100 (BST)
From: Mark Valentine <mark@thuvia.demon.co.uk>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Re: [PATCH] fix for detecting empty CVS commit log message

>Number:         28295
>Category:       gnu
>Synopsis:       Re: [PATCH] fix for detecting empty CVS commit log message
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 20 10:20:00 PDT 2001
>Closed-Date:    Mon Jul 2 11:29:03 PDT 2001
>Last-Modified:  Mon Jul 02 11:30:33 PDT 2001
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
 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>
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: greid 
State-Changed-When: Mon Jul 2 11:29:03 PDT 2001 
State-Changed-Why:  
Part of the audit trail of 28189 


Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: greid 
Responsible-Changed-When: Mon Jul 2 11:29:03 PDT 2001 
Responsible-Changed-Why:  
Misfiled 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=28295 
>Unformatted:
