nvme-fabrics: fix memory leak when parsing host ID option
[linux-2.6-block.git] / drivers / nvme / host / fabrics.c
index 2f68befd31bf5fcb66559d3fb563730c22ac9d30..eb46967bb0d5e04f6a92747e5d4575279c19a7e7 100644 (file)
@@ -738,7 +738,9 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
                                ret = -ENOMEM;
                                goto out;
                        }
-                       if (uuid_parse(p, &hostid)) {
+                       ret = uuid_parse(p, &hostid);
+                       kfree(p);
+                       if (ret) {
                                pr_err("Invalid hostid %s\n", p);
                                ret = -EINVAL;
                                goto out;