summaryrefslogtreecommitdiff
path: root/ext2fs/ialloc.c
diff options
context:
space:
mode:
authorMaksym Planeta <mcsim.planeta@gmail.com>2012-10-05 20:07:29 +0300
committerMaksym Planeta <mcsim.planeta@gmail.com>2012-10-28 12:33:35 +0100
commit3fb8db3ee9f5bf97c597a09af75a344e5c9b8d01 (patch)
treeb7b1db6339cd1e30066ff0f58d781e51ad03ff3c /ext2fs/ialloc.c
parentc62283c1d680158a92f549231539ef6134b4ab65 (diff)
Fix bugs with initialization of variables, created on stack.
* ext2fs/balloc.c (ext2_new_block): Function changed. * ext2fs/ialloc.c (ext2_alloc_inode): Function changed.
Diffstat (limited to 'ext2fs/ialloc.c')
-rw-r--r--ext2fs/ialloc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext2fs/ialloc.c b/ext2fs/ialloc.c
index 15c17a4e..6ba75822 100644
--- a/ext2fs/ialloc.c
+++ b/ext2fs/ialloc.c
@@ -111,7 +111,7 @@ diskfs_free_node (struct node *np, mode_t old_mode)
ino_t
ext2_alloc_inode (ino_t dir_inum, mode_t mode)
{
- char *bh;
+ char *bh = 0;
int i, j, inum, avefreei;
struct ext2_group_desc *gdp;
struct ext2_group_desc *tmp;
@@ -119,6 +119,7 @@ ext2_alloc_inode (ino_t dir_inum, mode_t mode)
spin_lock (&global_lock);
repeat:
+ assert (! bh);
gdp = NULL;
i = 0;
@@ -221,12 +222,15 @@ repeat:
if (set_bit (inum, bh))
{
ext2_warning ("bit already set for inode %d", inum);
+ bh = 0;
goto repeat;
}
record_global_poke (bh);
+ bh = 0;
}
else
{
+ bh = 0;
if (gdp->bg_free_inodes_count != 0)
{
ext2_error ("free inodes count corrupted in group %d", i);
@@ -254,6 +258,7 @@ repeat:
sblock_dirty = 1;
sync_out:
+ assert (! bh);
spin_unlock (&global_lock);
alloc_sync (0);