From: John Hodge Date: Mon, 20 Aug 2012 04:42:26 +0000 (+0800) Subject: Modules/Ext2 - Fixed compile errors caused by differing compiler versions X-Git-Tag: rel0.15~706^2~34 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=cd52bcda41d322aaaf61adeec0edaaecc791c43b;p=tpg%2Facess2.git Modules/Ext2 - Fixed compile errors caused by differing compiler versions --- diff --git a/KernelLand/Modules/Filesystems/Ext2/dir.c b/KernelLand/Modules/Filesystems/Ext2/dir.c index ef347ad0..7b78ae43 100644 --- a/KernelLand/Modules/Filesystems/Ext2/dir.c +++ b/KernelLand/Modules/Filesystems/Ext2/dir.c @@ -242,7 +242,8 @@ int Ext2_Link(tVFS_Node *Node, const char *Name, tVFS_Node *Child) int block = 0, ofs = 0; Uint size; void *blockData; - int bestMatch = -1, bestSize, bestBlock, bestOfs, bestNeedsSplit; + int bestMatch = -1; + int bestSize=0, bestBlock=0, bestOfs=0, bestNeedsSplit=0; int nEntries; ENTER("pNode sName pChild", @@ -276,6 +277,7 @@ int Ext2_Link(tVFS_Node *Node, const char *Name, tVFS_Node *Child) base = inode.i_block[0] * disk->BlockSize; VFS_ReadAt( disk->FD, base, disk->BlockSize, blockData ); block = 0; + nEntries = 0; // Find File while(size > 0) { diff --git a/KernelLand/Modules/Filesystems/Ext2/ext2.c b/KernelLand/Modules/Filesystems/Ext2/ext2.c index 5015e14b..adf91635 100644 --- a/KernelLand/Modules/Filesystems/Ext2/ext2.c +++ b/KernelLand/Modules/Filesystems/Ext2/ext2.c @@ -95,7 +95,7 @@ int Ext2_Detect(int FD) */ tVFS_Node *Ext2_InitDevice(const char *Device, const char **Options) { - tExt2_Disk *disk; + tExt2_Disk *disk = NULL; int fd; int groupCount; tExt2_SuperBlock sb; @@ -118,9 +118,7 @@ tVFS_Node *Ext2_InitDevice(const char *Device, const char **Options) if(sb.s_magic != 0xEF53) { Log_Warning("EXT2", "Volume '%s' is not an EXT2 volume (0x%x != 0xEF53)", Device, sb.s_magic); - VFS_Close(fd); - LEAVE('n'); - return NULL; + goto _error; } if( sb.s_blocks_per_group < MIN_BLOCKS_PER_GROUP ) { @@ -137,9 +135,7 @@ tVFS_Node *Ext2_InitDevice(const char *Device, const char **Options) disk = malloc(sizeof(tExt2_Disk) + sizeof(tExt2_Group)*groupCount); if(!disk) { Log_Warning("EXT2", "Unable to allocate disk structure"); - VFS_Close(fd); - LEAVE('n'); - return NULL; + goto _error; } disk->FD = fd; memcpy(&disk->SuperBlock, &sb, 1024); @@ -201,7 +197,8 @@ tVFS_Node *Ext2_InitDevice(const char *Device, const char **Options) LEAVE('p', &disk->RootNode); return &disk->RootNode; _error: - free(disk); + if( disk ) + free(disk); VFS_Close(fd); LEAVE('n'); return NULL;