summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2013-12-27 19:17:29 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2013-12-27 19:17:29 +0000
commit36ed7bef453ff5b39a4008978cbd3708470c3541 (patch)
tree7d966a1f36a599c4f06329df2fe2c248fb8e95a5 /sbin
parentab254730433eb671acd4f65fe5dd882081ee5c50 (diff)
from netbsd, free(bbp) in error paths. Coverity CID 274748.
via Loganaden Velvindron
Diffstat (limited to 'sbin')
-rw-r--r--sbin/newfs_ext2fs/mke2fs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/newfs_ext2fs/mke2fs.c b/sbin/newfs_ext2fs/mke2fs.c
index c3d8f5a81f3..222eb0eab2c 100644
--- a/sbin/newfs_ext2fs/mke2fs.c
+++ b/sbin/newfs_ext2fs/mke2fs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mke2fs.c,v 1.5 2013/04/17 03:33:13 deraadt Exp $ */
+/* $OpenBSD: mke2fs.c,v 1.6 2013/12/27 19:17:28 deraadt Exp $ */
/* $NetBSD: mke2fs.c,v 1.13 2009/10/19 18:41:08 bouyer Exp $ */
/*-
@@ -1262,8 +1262,10 @@ alloc(uint32_t size, uint16_t mode)
#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;
@@ -1271,6 +1273,7 @@ alloc(uint32_t size, uint16_t mode)
if ((map & (1 << i)) == 0)
goto gotit;
}
+ free(bbp);
return 0;
gotit: