vhost: fix error handling in destroy
authorYuanhan Liu <yuanhan.liu@linux.intel.com>
Tue, 5 Apr 2016 06:00:43 +0000 (14:00 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 6 Apr 2016 10:27:57 +0000 (12:27 +0200)
commit71dc571efd0a930ebb7334260059e87711fdfc27
treee37f9dabead73391011d0323e88f20f7117bde3d
parent2329a101f478c6afe59b7d92a284d19b19e8326a
vhost: fix error handling in destroy

Fix following coverity defect:

    291     void
    292     vhost_destroy_device(struct vhost_device_ctx ctx)
    293     {
    294             struct virtio_net *dev = get_device(ctx);
    295
    >>>     CID 124565:  Null pointer dereferences  (NULL_RETURNS)
    >>>     Dereferencing a null pointer "dev".

Fixes: 45ca9c6f7bc6 ("vhost: get rid of linked list for devices")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
lib/librte_vhost/virtio-net.c