From 669ac9d0c843f9ccf07d4969ff6bff75fafee01f Mon Sep 17 00:00:00 2001 From: Michael Grunder Date: Tue, 28 Jan 2020 12:13:05 -0800 Subject: Safe allocation wrappers (#754) Create allocation wrappers with a configurable OOM handler (defaults to abort()). See #752, #747 --- adapters/ae.h | 2 +- adapters/ivykis.h | 2 +- adapters/libev.h | 2 +- adapters/libevent.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'adapters') diff --git a/adapters/ae.h b/adapters/ae.h index 5c551c2..0393992 100644 --- a/adapters/ae.h +++ b/adapters/ae.h @@ -108,7 +108,7 @@ static int redisAeAttach(aeEventLoop *loop, redisAsyncContext *ac) { return REDIS_ERR; /* Create container for context and r/w events */ - e = (redisAeEvents*)malloc(sizeof(*e)); + e = (redisAeEvents*)hi_malloc(sizeof(*e)); e->context = ac; e->loop = loop; e->fd = c->fd; diff --git a/adapters/ivykis.h b/adapters/ivykis.h index 6a12a86..75616ee 100644 --- a/adapters/ivykis.h +++ b/adapters/ivykis.h @@ -55,7 +55,7 @@ static int redisIvykisAttach(redisAsyncContext *ac) { return REDIS_ERR; /* Create container for context and r/w events */ - e = (redisIvykisEvents*)malloc(sizeof(*e)); + e = (redisIvykisEvents*)hi_malloc(sizeof(*e)); e->context = ac; /* Register functions to start/stop listening for events */ diff --git a/adapters/libev.h b/adapters/libev.h index 2bf8d52..abad436 100644 --- a/adapters/libev.h +++ b/adapters/libev.h @@ -119,7 +119,7 @@ static int redisLibevAttach(EV_P_ redisAsyncContext *ac) { return REDIS_ERR; /* Create container for context and r/w events */ - e = (redisLibevEvents*)malloc(sizeof(*e)); + e = (redisLibevEvents*)hi_malloc(sizeof(*e)); e->context = ac; #if EV_MULTIPLICITY e->loop = loop; diff --git a/adapters/libevent.h b/adapters/libevent.h index a495277..0674ca6 100644 --- a/adapters/libevent.h +++ b/adapters/libevent.h @@ -152,7 +152,7 @@ static int redisLibeventAttach(redisAsyncContext *ac, struct event_base *base) { return REDIS_ERR; /* Create container for context and r/w events */ - e = (redisLibeventEvents*)calloc(1, sizeof(*e)); + e = (redisLibeventEvents*)hi_calloc(1, sizeof(*e)); e->context = ac; /* Register functions to start/stop listening for events */ -- cgit v1.2.3