tap: fix memory leak on failure in net_init_tap()
commitfac7d7b1cdb21f921d7ac396365f5e920ef03096
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 10 Jan 2017 19:21:54 +0000 (10 19:21 +0000)
committerJason Wang <jasowang@redhat.com>
Fri, 20 Jan 2017 02:58:26 +0000 (20 10:58 +0800)
treedd3877fdffab1aa851a402520491ce3eb910c50e
parenta023b7ac6262106e9a7d248bb61ec928fbf94896
tap: fix memory leak on failure in net_init_tap()

Commit 091a6b2ac fixed most of the memory leaks in failure
paths in net_init_tap() reported by Coverity (CID 1356216),
but missed one. Fix it by deferring the allocation of
fds and vhost_fds until after the error check.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/tap.c