瀏覽代碼

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>
Jim Meyering 17 年之前
父節點
當前提交
22caa0417d
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      lib/inflate.c

+ 3 - 0
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;