From 22caa0417db3b1d3dfafc9b7c0bf31baf8d667e7 Mon Sep 17 00:00:00 2001 From: Jim Meyering <jim@meyering.net> Date: Tue, 29 Apr 2008 00:59:09 -0700 Subject: [PATCH] lib/inflate.c: handle failed malloc() lib/inflate.c (inflate_dynamic): Don't deref NULL upon failed malloc. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> --- lib/inflate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/inflate.c b/lib/inflate.c index 845f91d3ac12..9762294be062 100644 --- a/lib/inflate.c +++ b/lib/inflate.c @@ -811,6 +811,9 @@ DEBG("<dyn"); ll = malloc(sizeof(*ll) * (286+30)); /* literal/length and distance code lengths */ #endif + if (ll == NULL) + return 1; + /* make local bit buffer */ b = bb; k = bk;