Changes by: cha0smaster
Update of /cvsroot/linux-ntfs/ntfsprogs/libntfs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23824/libntfs
Modified Files:
inode.c
Log Message:
Optimize a bit previous ntfs_inode_close fix.
Index: inode.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/libntfs/inode.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -p -r1.59 -r1.60
--- inode.c 2 Jul 2005 13:58:02 -0000 1.59
+++ inode.c 2 Jul 2005 17:48:59 -0000 1.60
@@ -249,14 +249,18 @@ int ntfs_inode_close(ntfs_inode *ni)
memmove(tmp_nis + i, tmp_nis + i + 1,
(base_ni->nr_extents - i - 1) *
sizeof(ntfs_inode *));
+ /* Buffer should be for multiple of four extents. */
+ if ((--base_ni->nr_extents) & 3) {
+ i = -1;
+ break;
+ }
/*
* ElectricFence is unhappy with realloc(x,0) as free(x)
* thus we explicitely separate these two cases.
*/
- if (--base_ni->nr_extents) {
+ if (base_ni->nr_extents) {
/* Resize the memory buffer. */
- tmp_nis = realloc(tmp_nis, ((base_ni->
- nr_extents + 3) & ~3) *
+ tmp_nis = realloc(tmp_nis, base_ni->nr_extents *
sizeof(ntfs_inode *));
/* Ignore errors, they don't really matter. */
if (tmp_nis)
|