diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2023-04-12 12:41:33 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2023-04-12 12:41:33 +0100 |
commit | 77a87a07224b1e8167c99213065f5244bdbeca83 (patch) | |
tree | 85f9e15897c13a04372092be953896dec8d7395c | |
parent | abb02ce0e76a8e00026699a863ab2d11d88f56d4 (diff) | |
parent | 4b32319cdacd99be983e1a74128289ef52c5964e (diff) |
Merge tag 'coverity-fixes-pull-request' of git://git.infradead.org/qemu-nvme into staging
hw/nvme coverity fixes
Fix two issues reported by coverity (CID 1451080 and 1451082).
# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmQ2gfEACgkQTeGvMW1P
# DemcEQf/V+arKs9OFhfqu3OtKQu5R4F2i2Tq3aRulrbZr/dPGkkLjSQjgGdkbg0F
# 8TZQYezFGZdg45QqxfxpVxPf8hrlGX6c/cbVZp9BnIGGXForLLHfrvNQpVVg5Ldm
# 8fA5zBccbnH2ER4nf12xf56WzjKWIpv5Xt/+hqOSoghThKfUxjIowR58fxoZySy6
# zl0cr6+FMnMZkLxGN0EslckNzYzpX5aXfJLMZKPG3G07EVmTgcGfJxjw0pWkzbq6
# ictMeP8BTbOU4IGLC2SIRppkiWEr3rUCL4aPhlPg90rIyXDU4onYP8dr0Y5ZI0gY
# QFtaZpTYEeRw84AJhgyR4U6h37UE/g==
# =kGwj
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 12 Apr 2023 11:03:29 BST
# gpg: using RSA key 522833AA75E2DCE6A24766C04DE1AF316D4F0DE9
# gpg: Good signature from "Klaus Jensen <its@irrelevant.dk>" [full]
# gpg: aka "Klaus Jensen <k.jensen@samsung.com>" [full]
# Primary key fingerprint: DDCA 4D9C 9EF9 31CC 3468 4272 63D5 6FC5 E55D A838
# Subkey fingerprint: 5228 33AA 75E2 DCE6 A247 66C0 4DE1 AF31 6D4F 0DE9
* tag 'coverity-fixes-pull-request' of git://git.infradead.org/qemu-nvme:
hw/nvme: fix memory leak in nvme_dsm
hw/nvme: fix memory leak in fdp ruhid parsing
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | hw/nvme/ctrl.c | 3 | ||||
-rw-r--r-- | hw/nvme/ns.c | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 8b7be14209..ac24eeb5ed 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -2619,6 +2619,9 @@ static uint16_t nvme_dsm(NvmeCtrl *n, NvmeRequest *req) status = nvme_h2c(n, (uint8_t *)iocb->range, sizeof(NvmeDsmRange) * nr, req); if (status) { + g_free(iocb->range); + qemu_aio_unref(iocb); + return status; } diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c index cfac960dcf..547c0b1543 100644 --- a/hw/nvme/ns.c +++ b/hw/nvme/ns.c @@ -399,7 +399,8 @@ static bool nvme_ns_init_fdp(NvmeNamespace *ns, Error **errp) NvmeEnduranceGroup *endgrp = ns->endgrp; NvmeRuHandle *ruh; uint8_t lbafi = NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas); - unsigned int *ruhid, *ruhids; + g_autofree unsigned int *ruhids = NULL; + unsigned int *ruhid; char *r, *p, *token; uint16_t *ph; |