Source-Changes-HG archive

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

[src/trunk]: src/sbin/newfs_ext2fs free(bbp) in error paths. Coverity CID 27...



details:   https://anonhg.NetBSD.org/src/rev/77d11a11d7f4
branches:  trunk
changeset: 784715:77d11a11d7f4
user:      apb <apb%NetBSD.org@localhost>
date:      Thu Feb 07 11:00:59 2013 +0000

description:
free(bbp) in error paths.  Coverity CID 274748.

diffstat:

 sbin/newfs_ext2fs/mke2fs.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 0b7c69fa9787 -r 77d11a11d7f4 sbin/newfs_ext2fs/mke2fs.c
--- a/sbin/newfs_ext2fs/mke2fs.c        Thu Feb 07 10:44:45 2013 +0000
+++ b/sbin/newfs_ext2fs/mke2fs.c        Thu Feb 07 11:00:59 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mke2fs.c,v 1.17 2013/01/22 09:39:13 dholland Exp $     */
+/*     $NetBSD: mke2fs.c,v 1.18 2013/02/07 11:00:59 apb Exp $  */
 
 /*-
  * Copyright (c) 2007 Izumi Tsutsui.  All rights reserved.
@@ -100,7 +100,7 @@
 #if 0
 static char sccsid[] = "@(#)mkfs.c     8.11 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: mke2fs.c,v 1.17 2013/01/22 09:39:13 dholland Exp $");
+__RCSID("$NetBSD: mke2fs.c,v 1.18 2013/02/07 11:00:59 apb Exp $");
 #endif
 #endif /* not lint */
 
@@ -1276,8 +1276,10 @@
 #endif
 
        loc = skpc(~0U, len, bbp);
-       if (loc == 0)
+       if (loc == 0) {
+               free(bbp);
                return 0;
+       }
        loc = len - loc;
        map = bbp[loc];
        bno = loc * NBBY;
@@ -1285,6 +1287,7 @@
                if ((map & (1 << i)) == 0)
                        goto gotit;
        }
+       free(bbp);
        return 0;
        
  gotit:



Home | Main Index | Thread Index | Old Index