nvme: fixup memory leak in nvme_init_identify()
authorHannes Reinecke <hare@suse.de>
Fri, 25 May 2018 09:06:27 +0000 (11:06 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 25 May 2018 14:50:12 +0000 (16:50 +0200)
If nvme_get_effects_log() failed the 'id' buffer from the previous
nvme_identify_ctrl() call will never be freed.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c

index fd206a6adad591f6b75de41e9d79c0e46a347cc0..2c4cf65641a6b12d7706ae1214f64d1f6c3bc15f 100644 (file)
@@ -2316,7 +2316,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
        if (id->lpa & NVME_CTRL_LPA_CMD_EFFECTS_LOG) {
                ret = nvme_get_effects_log(ctrl);
                if (ret < 0)
-                       return ret;
+                       goto out_free;
        }
 
        if (!ctrl->identified) {