From: Tomasz Jozwiak <tjozwia...@gmail.com> Sent: Monday, July 1, 2019 2:33 AM To: Shally Verma <shal...@marvell.com>; dev@dpdk.org; fiona.tr...@intel.com; arturx.tryb...@intel.com Subject: Re: [EXT] [PATCH v4 3/6] app/test-compress-perf: add verification test case
… + if (ctx != NULL) { + ctx->mem.dev_id = dev_id; + ctx->mem.qp_id = qp_id; + ctx->options = options; + + if (!comp_perf_allocate_memory(ctx->options, &ctx->mem) && + !prepare_bufs(ctx->options, &ctx->mem)) + return ctx; What if condition fails on comp_per_allocate_memory(), then it will go to verify_test_destructor(), so comp_perf_free_memory() check if mem != NULL before calling actual free? [Tomek] I mean it's ok. Please take in to account that we was able to allocate 'cperf_verify_ctx struct' - cause ctx != NULL here. that means 'mem struct' inside 'cperf_verify_ctx struct' exists for sure: struct cperf_verify_ctx { struct cperf_mem_resources mem; struct comp_test_data *options; int silent; size_t comp_data_sz; size_t decomp_data_sz; double ratio; }; and all fields inside 'struct cperf_mem_resources mem' are zeroed. We don't need to check mem != NULL before free, because in this place mem != NULL for sure. Also it's ok to call 'rte_free', 'rte_mempool_free' and 'rte_pktmbuf_free' with NULL ptr. as a argument because the check is inside all of these functions. [Shally] Okay. Thx for the comments. -- Tomek