From: Stephen Hemminger Date: Tue, 7 Apr 2015 21:21:00 +0000 (-0700) Subject: examples: remove useless null checks before rte_free X-Git-Tag: spdx-start~9320 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=176582b8a4868822b4e827a63af3db169fe03d4a;p=dpdk.git examples: remove useless null checks before rte_free rte_free handles getting passed a NULL pointer. Signed-off-by: Stephen Hemminger Acked-by: Neil Horman --- diff --git a/examples/vhost/main.c b/examples/vhost/main.c index c3fcb80941..ad10f820bb 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -2747,8 +2747,7 @@ new_device (struct virtio_net *dev) RTE_LOG(INFO, VHOST_DATA, "(%"PRIu64") Failed to add device to data core\n", dev->device_fh); vdev->ready = DEVICE_SAFE_REMOVE; destroy_device(dev); - if (vdev->regions_hpa) - rte_free(vdev->regions_hpa); + rte_free(vdev->regions_hpa); rte_free(vdev); return -1; } diff --git a/examples/vhost_xen/vhost_monitor.c b/examples/vhost_xen/vhost_monitor.c index 9d99962ce1..64559937d3 100644 --- a/examples/vhost_xen/vhost_monitor.c +++ b/examples/vhost_xen/vhost_monitor.c @@ -298,10 +298,9 @@ virtio_net_config_ll *new_device(unsigned int virtio_idx, struct xen_guest *gues err: if (new_ll_dev) free(new_ll_dev); - if (virtqueue_rx) - rte_free(virtqueue_rx); - if (virtqueue_tx) - rte_free(virtqueue_tx); + rte_free(virtqueue_rx); + rte_free(virtqueue_tx); + return NULL; } diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c index 04344ae991..7d892e2b43 100644 --- a/examples/vm_power_manager/channel_manager.c +++ b/examples/vm_power_manager/channel_manager.c @@ -800,9 +800,7 @@ channel_manager_exit(void) rte_free(vm_info); } - if (global_cpumaps != NULL) - rte_free(global_cpumaps); - if (global_vircpuinfo != NULL) - rte_free(global_vircpuinfo); + rte_free(global_cpumaps); + rte_free(global_vircpuinfo); disconnect_hypervisor(); }