From: Mike Frysinger Date: Mon, 6 Dec 2010 03:57:38 -0500 Subject: [U-Boot] [PATCH] LZMA: Avoid free on null pointer. In-Reply-To: References: <1291540724-26513-1-git-send-email-luigi.mantellini@idf-hit.com> <201012060215.36947.vapier@gentoo.org> Message-ID: <201012060357.39766.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Monday, December 06, 2010 03:59:44 Luigi Mantellini wrote: > On Mon, Dec 6, 2010 at 8:15 AM, Mike Frysinger wrote: > > On Sunday, December 05, 2010 04:18:44 Luigi 'Comio' Mantellini wrote: > >> On structure Initialization, LZMA code tries to free the dictionary > >> and probs buffers, also when these are null pointers. Add some > >> check in order to prevent the free on null pointers. > > > > your patch only checks p->probs, not any dictionary buffer. if you > > follow the code path: > > > > ... > > void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc) > > { > > alloc->Free(alloc, p->probs); > > p->probs = 0; > > } > > ... > > g_Alloc.Free = SzFree; > > ... > > static void SzFree(void *p, void *address) { p = p; free(address); } > > ... > > > > this only ends up doing free(p->probs) which is free(NULL) which isnt a > > bug. > > In general I prefer avoid to free a null pointer, and I consider a > free on a not-malloc-eted pointer a bug. sorry, but this is not an acceptable reason. so unless you have an actual error report here, your patch gets NAK-ed. -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20101206/9e0e07a3/attachment.pgp