Skip to contentSkip to conversation

lib: Handle failed malloc.

PATCH New Jim Meyering 1 participant 1 message Feb 19, 2008 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: Handle failed malloc.

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

---

lib/inflate.c +3 -0
index 845f91d..9762294 100644
@@ -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