[PATCH 04/22] reftable/basics: handle allocation failures in `reftable_calloc()`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Handle allocation failures in `reftable_calloc()`.

Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
---
 reftable/basics.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/reftable/basics.c b/reftable/basics.c
index 4adc98cf5de..b404900b5d9 100644
--- a/reftable/basics.c
+++ b/reftable/basics.c
@@ -39,6 +39,8 @@ void *reftable_calloc(size_t nelem, size_t elsize)
 {
 	size_t sz = st_mult(nelem, elsize);
 	void *p = reftable_malloc(sz);
+	if (!p)
+		return NULL;
 	memset(p, 0, sz);
 	return p;
 }
-- 
2.46.0.551.gc5ee8f2d1c.dirty





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux