From: Laurence Withers Date: Tue, 4 Oct 2011 10:14:51 +0000 Subject: [U-Boot] [PATCH] ubifs bad superblock bug In-Reply-To: References: Message-ID: <20111004101451.GG15470@lwithers.me.uk> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, Oct 04, 2011 at 06:41:52PM +0900, Kyungmin Park wrote: > On Tue, Oct 4, 2011 at 6:08 PM, larsi wrote: > > - ? ? ? free(ubifs_sb->s_fs_info); > > - ? ? ? free(ubifs_sb); > > + ? ? ? if (ubifs_sb != null) { Should be NULL. > > + ? ? ? ? ? ? ? free(ubifs_sb->s_fs_info); > > + ? ? ? ? ? ? ? free(ubifs_sb); > > + ? ? ? } > Which statement is problem? Basically free() check the null address. > so If ubifs_sb->s_fs_info doesn't have value its skipped. and ubifs_sb > is similar. The problem is the first call to free() above. If ubifs_sb is null, then free(ubis_sb->...) will be a null pointer dereference. Bye for now, -- Laurence Withers, http://www.guralp.com/ Direct tel:+447753988197 or tel:+443333408643 Software Engineer General support queries: CMG-DCM CMG-EAM CMG-NAM