From 0c703940a5ce4913beaecc0e036ae4dde0f08605 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Wed, 6 Jan 2016 10:46:59 -0700 Subject: [PATCH] ioat: allocate channel context with calloc() This ensures that any uninitialized fields are 0/NULL so if ioat_channel_start() fails, ioat_channel_destruct() will not try to free bogus pointers. Change-Id: I99278c9fa280cbcdf3f7448e77db3ac98b59cdd6 Signed-off-by: Daniel Verkamp --- lib/ioat/ioat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ioat/ioat.c b/lib/ioat/ioat.c index f4fa98f9f..db119c5c9 100644 --- a/lib/ioat/ioat.c +++ b/lib/ioat/ioat.c @@ -498,7 +498,7 @@ ioat_attach(void *device) struct ioat_channel *ioat; uint32_t cmd_reg; - ioat = malloc(sizeof(struct ioat_channel)); + ioat = calloc(1, sizeof(struct ioat_channel)); if (ioat == NULL) { return NULL; }