[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Cvs-dev] Re: CVS Coverity scan via NetBSD fixes
From: |
Mark D. Baushke |
Subject: |
[Cvs-dev] Re: CVS Coverity scan via NetBSD fixes |
Date: |
Wed, 31 May 2006 08:25:06 -0700 |
Hi Christos,
The following is the latest NetBSD patch based on
run 33. I will shortly be updating the items listed
as BUG to RESOLVED for which this patch is a FIX.
This is the sixth patch I have provided based on
the NetBSD sources
(CVSROOT=:ext:address@hidden/cvsroot).
The following patch is adapted from the one
committed to the STABLE branch on Savannah.nongnu.org
(CVSROOT=:pserver:address@hidden:/sources/cvs
branch: cvs1-11-x-branch
module: ccvs/src).
I am still running a regression test of these
changes merged onto the FEATURE branch and I will
commit there when that is complete.
I would be much obliged if you would commit it to
the NetBSD sources.
I'll continue to work through the remaining items
as time permits.
Enjoy!
-- Mark
Log message:
2006-05-31 Mark D. Baushke <address@hidden>
* add.c (add): Fix memory leak.
[Fixes NetBSD coverity cid-3751.]
(add_directory): Fix memory leak.
[Fixes NetBSD coverity cid-3640.]
* commit.c (remove_file): Fix memory leak.
[Fixes NetBSD coverity cid-3752.]
* checkin.c (Checkin): Avoid possible NULL dereference.
[Fixes NetBSD coverity cid-2425.]
* client.c (auth_server): Fix memory leak.
[Fixes NetBSD coverity cid-3404.]
* rcs.c (RCS_checkin): Add assert (tip).
[Fixes NetBSD coverity cid-2424.]
Index: add.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/xcvs/src/add.c,v
retrieving revision 1.4
diff -u -p -r1.4 add.c
--- add.c 27 May 2006 03:01:09 -0000 1.4
+++ add.c 31 May 2006 14:59:23 -0000
@@ -168,6 +168,8 @@ add (argc, argv)
nothing, it would spit back a usage message). */
if (options)
free (options);
+ if (message)
+ free (message);
return err;
}
@@ -844,7 +846,10 @@ add_directory (finfo)
fileattr_write ();
fileattr_free ();
if (attrs != NULL)
+ {
free (attrs);
+ attrs = NULL;
+ }
/*
* Set up an update list with a single title node for Update_Logfile
@@ -882,6 +887,8 @@ add_directory (finfo)
free (rcsdir);
free (message);
+ if (attrs != NULL)
+ free (attrs);
return 0;
Index: checkin.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/xcvs/src/checkin.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 checkin.c
--- checkin.c 4 Feb 2006 15:54:57 -0000 1.1.1.1
+++ checkin.c 31 May 2006 14:59:23 -0000
@@ -79,7 +79,8 @@ Checkin (type, finfo, rev, tag, options,
changes is if the file contains RCS keywords. So we if
we are not expanding RCS keywords, we are done. */
- if (strcmp (options, "-V4") == 0) /* upgrade to V5 now */
+ if (options != NULL
+ && strcmp (options, "-V4") == 0) /* upgrade to V5 now */
options[0] = '\0';
/* FIXME: If PreservePermissions is on, RCS_cmp_file is
Index: client.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/xcvs/src/client.c,v
retrieving revision 1.5
diff -u -p -r1.5 client.c
--- client.c 12 May 2006 15:33:17 -0000 1.5
+++ client.c 31 May 2006 14:59:23 -0000
@@ -3970,6 +3970,7 @@ auth_server (root, lto_server, lfrom_ser
/* Paranoia. */
memset (password, 0, strlen (password));
+ free (password);
# else /* ! AUTH_CLIENT_SUPPORT */
error (1, 0, "INTERNAL ERROR: This client does not support pserver
authentication");
# endif /* AUTH_CLIENT_SUPPORT */
Index: commit.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/xcvs/src/commit.c,v
retrieving revision 1.4
diff -u -p -r1.4 commit.c
--- commit.c 12 May 2006 15:33:17 -0000 1.4
+++ commit.c 31 May 2006 14:59:23 -0000
@@ -1746,6 +1746,8 @@ remove_file (finfo, tag, message)
if (!quiet)
error (0, retcode == -1 ? errno : 0,
"failed to commit dead revision for `%s'", finfo->fullname);
+ if (prev_rev != NULL)
+ free (prev_rev);
return 1;
}
/* At this point, the file has been committed as removed. We should
Index: rcs.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/xcvs/src/rcs.c,v
retrieving revision 1.4
diff -u -p -r1.4 rcs.c
--- rcs.c 27 May 2006 03:01:09 -0000 1.4
+++ rcs.c 31 May 2006 14:59:23 -0000
@@ -5364,6 +5364,7 @@ workfile);
if (dots == 0)
{
tip = xstrdup (rcs->head);
+ assert (tip != NULL);
if (atoi (tip) != atoi (branch))
{
newrev = (char *) xrealloc (newrev, strlen (newrev) + 3);