From 84cfc97fdf9472185279bbbdcf073f181223476c Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Tue, 22 Sep 2015 16:06:37 -0700 Subject: [PATCH] nvme: fix allocation in test_nvme_qpair_destroy act_tr is supposed to be allocated with the system allocator (malloc/calloc) rather than nvme_malloc. Additionally, the size was incorrect - act_tr is an array of pointers, not a single struct nvme_tracker. Change-Id: I2c66b4891d11d0a8a32e3740c27fcfb42b1db2d7 Signed-off-by: Daniel Verkamp --- test/lib/nvme/unit/nvme_qpair_c/nvme_qpair_ut.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/lib/nvme/unit/nvme_qpair_c/nvme_qpair_ut.c b/test/lib/nvme/unit/nvme_qpair_c/nvme_qpair_ut.c index 2295b655b..acecc7598 100644 --- a/test/lib/nvme/unit/nvme_qpair_c/nvme_qpair_ut.c +++ b/test/lib/nvme/unit/nvme_qpair_c/nvme_qpair_ut.c @@ -287,10 +287,8 @@ void test_nvme_qpair_process_completions(void) void test_nvme_qpair_destroy(void) { struct nvme_qpair qpair = {0}; - struct nvme_request *req = NULL; struct nvme_controller ctrlr = {}; struct nvme_registers regs = {0}; - struct nvme_tracker *tr_temp; uint64_t phys_addr = 0; memset(&ctrlr, 0, sizeof(ctrlr)); @@ -302,8 +300,7 @@ void test_nvme_qpair_destroy(void) qpair.cpl = nvme_malloc("nvme_completion", sizeof(struct nvme_completion), 64, &phys_addr); - qpair.act_tr = nvme_malloc("nvme_tracker", sizeof(struct nvme_tracker), - 64, &phys_addr); + qpair.act_tr = calloc(32, sizeof(struct nvme_tracker *)); nvme_qpair_destroy(&qpair); }