[U-Boot] [PATCH 2/6 v2] LZMA: Avoid free on null pointer

Luigi 'Comio' Mantellini luigi.mantellini at idf-hit.com
Sat Dec 4 14:23:46 CET 2010


From: Luigi 'Comio' Mantellini <luigi.mantellini at idf-hit.com>


Signed-off-by: Luigi 'Comio' Mantellini <luigi.mantellini at idf-hit.com>
---
 lib/lzma/LzmaDec.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/lzma/LzmaDec.c b/lib/lzma/LzmaDec.c
index f941da2..b2a3aec 100644
--- a/lib/lzma/LzmaDec.c
+++ b/lib/lzma/LzmaDec.c
@@ -913,7 +913,9 @@ SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *sr
 
 void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
 {
-  alloc->Free(alloc, p->probs);
+  if (p->probs) {
+    alloc->Free(alloc, p->probs);
+  }
   p->probs = 0;
 }
 
-- 
1.7.3



More information about the U-Boot mailing list