free() already handles NULL pointer.
Signed-off-by: David Marchand <david.marchand@6wind.com>
while (!TAILQ_EMPTY(&devargs_list)) {
devargs = TAILQ_FIRST(&devargs_list);
TAILQ_REMOVE(&devargs_list, devargs, next);
- if (devargs->args)
- free(devargs->args);
+ free(devargs->args);
free(devargs);
}
}
static void
testsuite_teardown(void)
{
- if (test_params->pkt_eth_hdr != NULL) {
- free(test_params->pkt_eth_hdr);
- test_params->pkt_eth_hdr = NULL;
- }
+ free(test_params->pkt_eth_hdr);
+ test_params->pkt_eth_hdr = NULL;
/* Clean up and remove slaves from bonded device */
remove_slaves_and_stop_bonded_device();
while (!TAILQ_EMPTY(&devargs_list)) {
devargs = TAILQ_FIRST(&devargs_list);
TAILQ_REMOVE(&devargs_list, devargs, next);
- if (devargs->args)
- free(devargs->args);
+ free(devargs->args);
free(devargs);
}
}
if (ret != 0)
goto fail;
- if (src)
- free(src);
- if (dst)
- free(dst);
+ free(src);
+ free(dst);
return 0;
fail:
- if (src)
- free(src);
- if (dst)
- free(dst);
+ free(src);
+ free(dst);
return -1;
}
goto fail;
/* Free memory before test completed */
- if (src)
- free(src);
- if (dst)
- free(dst);
+ free(src);
+ free(dst);
return 0;
fail:
- if (src)
- free(src);
- if (dst)
- free(dst);
+ free(src);
+ free(dst);
return -1;
}
memset(&r->stats[lcore_id], 0, sizeof(r->stats[lcore_id]));
/* Free memory before test completed */
- if (src)
- free(src);
- if (dst)
- free(dst);
+ free(src);
+ free(dst);
return 0;
fail:
- if (src)
- free(src);
- if (dst)
- free(dst);
+ free(src);
+ free(dst);
return -1;
#endif
}
va = NULL;
}
out:
- if (pa_arr)
- free(pa_arr);
- if (gref_arr)
- free(gref_arr);
+ free(pa_arr);
+ free(gref_arr);
return va;
}
munmap(gnt_arr[i].va, pg_sz);
}
out:
- if (gnt_arr)
- free(gnt_arr);
+ free(gnt_arr);
if (orig_va)
munmap(orig_va, sz);
if (mp == NULL) {
- if (gref_arr)
- free(gref_arr);
- if (pa_arr)
- free(pa_arr);
+ free(gref_arr);
+ free(pa_arr);
/* some gref has already been de-allocated from the list in the driver,
* so dealloc one by one, and it is safe to deallocate twice
void
cpu_core_map_free(struct cpu_core_map *map)
{
- if (map)
- free(map);
+ free(map);
}
return 0;
error_parse:
- if (key_mask_str != NULL)
- free(key_mask_str);
- if (p->key_mask != NULL)
- free(p->key_mask);
+ free(key_mask_str);
+ free(p->key_mask);
return -1;
}
add_config_ll_entry(new_ll_dev);
return new_ll_dev;
err:
- if (new_ll_dev)
- free(new_ll_dev);
+ free(new_ll_dev);
rte_free(virtqueue_rx);
rte_free(virtqueue_tx);
{
if (gntnode == NULL)
return;
- if (gntnode->gnt_info)
- free(gntnode->gnt_info);
+ free(gntnode->gnt_info);
free(gntnode);
}
return gntnode;
err:
- if (gnt)
- free(gnt);
- if (gntnode)
- free(gntnode);
- if (gref_list)
- free(gref_list);
- if (buf)
- free(buf);
+ free(gnt);
+ free(gntnode);
+ free(gref_list);
+ free(buf);
return NULL;
}
}
ret = 0;
out:
- if (buf)
- free(buf);
+ free(buf);
return ret;
}
}
mempool->pindex = NULL;
- if (mempool->mempfn_tbl)
- free(mempool->mempfn_tbl);
+ free(mempool->mempfn_tbl);
mempool->mempfn_tbl = NULL;
}
free(buf);
return 0;
err:
- if (buf)
- free(buf);
+ free(buf);
if (vring->flag) {
munmap(vring->flag, pg_sz);
vring->flag = NULL;
}
vring->rx_pindex = NULL;
- if (vring->rxpfn_tbl)
- free(vring->rxpfn_tbl);
+ free(vring->rxpfn_tbl);
vring->rxpfn_tbl = NULL;
if (vring->txvring_addr) {
}
vring->tx_pindex = NULL;
- if (vring->txpfn_tbl)
- free(vring->txpfn_tbl);
+ free(vring->txpfn_tbl);
vring->txpfn_tbl = NULL;
if (vring->flag) {
goto out;
ret = 0;
out:
- if (buf)
- free(buf);
+ free(buf);
return ret;
}
return 0;
fail:
- if (buf)
- free(buf);
+ free(buf);
if (devargs) {
free(devargs->args);
free(devargs);
return 0;
fail:
- if (tmp_hp)
- free(tmp_hp);
+ free(tmp_hp);
return -1;
}
ret = 0;
end:
- if (name)
- free(name);
- if (args)
- free(args);
+ free(name);
+ free(args);
if (ret < 0)
RTE_LOG(ERR, EAL, "Driver, cannot attach the device\n");
if (!kvlist)
return;
- if (kvlist->str != NULL)
- free(kvlist->str);
-
+ free(kvlist->str);
free(kvlist);
}