From 388b66f727e39474a2160aa0d35402f4821aa8ae Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Sat, 11 Jun 2011 12:51:21 -0400 Subject: [PATCH] ext2fs: fix error handling in ext2fs_add_dir_block In ext2fs_add_dir_block() the dblist allocation size was changed to grow as the number of items in the dblist increases. However, the error handling in case of allocation failure wasn't changed to match. Fix the error case to revert to the old allocation size on failure. Signed-off-by: Andreas Dilger Signed-off-by: Theodore Ts'o --- lib/ext2fs/dblist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ext2fs/dblist.c b/lib/ext2fs/dblist.c index 84adcb2..d981f71 100644 --- a/lib/ext2fs/dblist.c +++ b/lib/ext2fs/dblist.c @@ -168,7 +168,7 @@ errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk, sizeof(struct ext2_db_entry), &dblist->list); if (retval) { - dblist->size -= 100; + dblist->size = old_size / sizeof(struct ext2_db_entry); return retval; } } -- 1.8.3.1