Remove redundant NULL pointer checks before free functions
found by nullfree.cocci
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ciara Power <ciara.power@intel.com>
---
app/test-crypto-perf/cperf_test_latency.c | 3 +--
app/test-crypto-perf/cperf_test_pmd_cyclecount.c | 9 +++------
app/test-crypto-perf/cperf_test_throughput.c | 3 +--
app/test-crypto-perf/cperf_test_vector_parsing.c | 6 ++----
app/test-crypto-perf/cperf_test_verify.c | 3 +--
5 files changed, 8 insertions(+), 16 deletions(-)
@@ -49,8 +49,7 @@ cperf_latency_test_free(struct cperf_latency_ctx *ctx)
rte_cryptodev_sym_session_free(ctx->sess);
}
- if (ctx->pool)
- rte_mempool_free(ctx->pool);
+ rte_mempool_free(ctx->pool);
rte_free(ctx->res);
rte_free(ctx);
@@ -79,14 +79,11 @@ cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)
}
}
- if (ctx->pool)
- rte_mempool_free(ctx->pool);
+ rte_mempool_free(ctx->pool);
- if (ctx->ops)
- rte_free(ctx->ops);
+ rte_free(ctx->ops);
- if (ctx->ops_processed)
- rte_free(ctx->ops_processed);
+ rte_free(ctx->ops_processed);
rte_free(ctx);
}
@@ -57,8 +57,7 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
rte_cryptodev_sym_session_free(ctx->sess);
}
}
- if (ctx->pool)
- rte_mempool_free(ctx->pool);
+ rte_mempool_free(ctx->pool);
rte_free(ctx);
}
@@ -551,10 +551,8 @@ parse_file(struct cperf_test_vector *vector, struct cperf_options *opts)
err:
if (fp)
fclose(fp);
- if (line)
- free(line);
- if (entry)
- rte_free(entry);
+ free(line);
+ rte_free(entry);
return -1;
}
@@ -42,8 +42,7 @@ cperf_verify_test_free(struct cperf_verify_ctx *ctx)
rte_cryptodev_sym_session_free(ctx->sess);
}
- if (ctx->pool)
- rte_mempool_free(ctx->pool);
+ rte_mempool_free(ctx->pool);
rte_free(ctx);
}