From: Andreas Dilger Date: Sat, 11 Jun 2011 16:51:21 +0000 (-0400) Subject: ext2fs: fix error handling in ext2fs_add_dir_block X-Git-Tag: v1.42-WIP-0702~13^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=388b66f727e39474a2160aa0d35402f4821aa8ae;p=thirdparty%2Fe2fsprogs.git 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 --- diff --git a/lib/ext2fs/dblist.c b/lib/ext2fs/dblist.c index 84adcb2b7..d981f7119 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; } }