]> The Tcpdump Group git mirrors - libpcap/commitdiff
From [email protected], via OpenBSD: add a check for memory allocation
authorguy <guy>
Sat, 8 Mar 2003 08:23:47 +0000 (08:23 +0000)
committerguy <guy>
Sat, 8 Mar 2003 08:23:47 +0000 (08:23 +0000)
failure.

gencode.c

index 15448a6b09f78510103a517793bb312bec2e5dbd..790fcd2b830c121068f254ed28d5b7dc50c9f80d 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -21,7 +21,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.186 2003-02-14 07:48:25 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.187 2003-03-08 08:23:47 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -225,6 +225,8 @@ newchunk(n)
                        bpf_error("out of memory");
                size = CHUNK0SIZE << k;
                cp->m = (void *)malloc(size);
+               if (cp->m == NULL)
+                       bpf_error("out of memory");
                memset((char *)cp->m, 0, size);
                cp->n_left = size;
                if (n > size)