redis: use SCCalloc to reduce risk of unitialized vars

pull/2672/head
Victor Julien 9 years ago
parent a64e5e77c7
commit 29c8125758

@ -55,7 +55,7 @@ void SCLogRedisInit()
*/ */
static SCLogRedisContext * SCLogRedisContextAlloc() static SCLogRedisContext * SCLogRedisContextAlloc()
{ {
SCLogRedisContext* ctx = (SCLogRedisContext*) SCMalloc(sizeof(SCLogRedisContext)); SCLogRedisContext* ctx = (SCLogRedisContext*) SCCalloc(1, sizeof(SCLogRedisContext));
if (ctx == NULL) { if (ctx == NULL) {
SCLogError(SC_ERR_MEM_ALLOC, "Unable to allocate redis context"); SCLogError(SC_ERR_MEM_ALLOC, "Unable to allocate redis context");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -80,7 +80,7 @@ static int SCConfLogReopenAsyncRedis(LogFileCtx *log_ctx);
*/ */
static SCLogRedisContext * SCLogRedisContextAsyncAlloc() static SCLogRedisContext * SCLogRedisContextAsyncAlloc()
{ {
SCLogRedisContext* ctx = (SCLogRedisContext*) SCMalloc(sizeof(SCLogRedisContext)); SCLogRedisContext* ctx = (SCLogRedisContext*) SCCalloc(1, sizeof(SCLogRedisContext));
if (unlikely(ctx == NULL)) { if (unlikely(ctx == NULL)) {
SCLogError(SC_ERR_MEM_ALLOC, "Unable to allocate redis context"); SCLogError(SC_ERR_MEM_ALLOC, "Unable to allocate redis context");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);

Loading…
Cancel
Save