test/crypto: fix mbuf reset after null check

Use m only after it was checked not to be NULL.

Fixes: 202d375c60 ("app/test: add cryptodev unit and performance tests")
Cc: stable@dpdk.org

Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
This commit is contained in:
Thierry Herbelot 2021-05-24 11:01:13 +02:00 committed by Akhil Goyal
parent c84e324e7c
commit 2b81eb2c99

View File

@ -135,10 +135,11 @@ setup_test_string(struct rte_mempool *mpool,
struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
size_t t_len = len - (blocksize ? (len % blocksize) : 0);
memset(m->buf_addr, 0, m->buf_len);
if (m) {
char *dst = rte_pktmbuf_append(m, t_len);
char *dst;
memset(m->buf_addr, 0, m->buf_len);
dst = rte_pktmbuf_append(m, t_len);
if (!dst) {
rte_pktmbuf_free(m);
return NULL;