netdevsim: dev: Fix memory leak in nsim_dev_take_snapshot_write
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Mon, 30 Mar 2020 23:27:02 +0000 (18:27 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 31 Mar 2020 03:14:22 +0000 (20:14 -0700)
commit3902baf9abfa320b21e38fe206d66d5e6688e721
treeb2aeca37ae751a6dd186a1b95df15dd875171826
parent1a795da798759471cfdc994f5efe998f915f1fd8
netdevsim: dev: Fix memory leak in nsim_dev_take_snapshot_write

In case memory resources for dummy_data were allocated, release them
before return.

Addresses-Coverity-ID: 1491997 ("Resource leak")
Fixes: 7ef19d3b1d5e ("devlink: report error once U32_MAX snapshot ids have been used")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/netdevsim/dev.c