bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Freeing non-heap pointer in normalize_cvsroot


From: Jon Miner
Subject: Freeing non-heap pointer in normalize_cvsroot
Date: Wed, 18 Oct 2000 12:50:43 -0500
User-agent: Mutt/1.2i

In normalize_cvsroot, free_port_s is no longer needed (and in fact
creates a call to free() with stack memory..)

"normalizing" also creates a problem with CVSROOTs and CVS/Root and
~/.cvspass files that don't have the port number in them..  It will
never match with the ~/.cvspass password (in get_cvs_password) until it
is checked-out again.  An explicit login with the _full_ repository name
(including port) does seem to fix the problem..

Fix is below:

Index: root.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/root.c,v
retrieving revision 1.44
diff -u -r1.44 root.c
--- root.c  2000/10/18 16:27:01 1.44
+++ root.c  2000/10/18 17:43:36
@@ -616,14 +616,12 @@
     char *cvsroot_canonical;
     char *p, *hostname;
     char port_s[11];
-    char free_port_s = 0;
-
+    
     /* get the appropriate host string */
     if (CVSroot_port || default_port)
     {
    sprintf (port_s, "%d", CVSroot_port ? CVSroot_port : default_port);
-   free_port_s = 1;
-    }
+   }
     else
     {
         strcpy(port_s, "");
@@ -643,9 +641,6 @@
     sprintf (cvsroot_canonical, ":pserver:%s@%s:%s%s",
        CVSroot_username ? CVSroot_username : default_user,
        hostname, port_s, CVSroot_directory);
-
-    if (free_port_s)
-   free (port_s);
 
     return cvsroot_canonical;
 }


-- 
.Jonathan J. Miner------------------Division of Information Technology.
|miner@doit.wisc.edu                 University Of Wisconsin - Madison|
|608/262.9655                               Room 3149 Computer Science|
`---------------------------------------------------------------------'

 It would be possible to optimize some forms of goto, but I haven't
 bothered.
              -- Larry Wall in <199709041935.MAA27136@wall.org>
                                                                 (170)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]