nvme/rpc: fix memory leak when cmdbuf decode fails for bdev_nvme_send_cmd

Change-Id: I265f7b87d85c99f1fd709418b575c500a686e093
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/622
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Tomasz Kulasek 2020-02-06 13:13:44 +01:00 committed by Tomasz Zawadzki
parent 83086b5973
commit c3e0eb456b

View File

@ -280,10 +280,12 @@ rpc_decode_cmdbuf(const struct spdk_json_val *val, void *out)
rc = spdk_base64_urlsafe_decode(cmdbuf, &raw_len, text);
if (rc) {
free(cmdbuf);
goto out;
}
if (raw_len != sizeof(*cmdbuf)) {
rc = -EINVAL;
free(cmdbuf);
goto out;
}