LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] lib: Handle failed malloc.
@ 2008-02-19 14:31 Jim Meyering
  0 siblings, 0 replies; only message in thread
From: Jim Meyering @ 2008-02-19 14:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton


* lib/inflate.c (inflate_dynamic): Don't deref NULL upon failed malloc.

Signed-off-by: Jim Meyering <meyering@redhat.com>
---
diff --git a/lib/inflate.c b/lib/inflate.c
index 845f91d..9762294 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;
--
1.5.4.19.gd3dfd

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-19 14:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-19 14:31 [PATCH] lib: Handle failed malloc Jim Meyering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).