From: Kenneth Heitke Date: Wed, 3 Apr 2019 23:45:43 +0000 (-0600) Subject: Fix possible memory leak on get-internal-log X-Git-Tag: v1.8~12^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c88a87c59876e206b33c612b9e852b8e3f3be403;p=users%2Fsagi%2Fnvme-cli.git Fix possible memory leak on get-internal-log --- diff --git a/plugins/intel/intel-nvme.c b/plugins/intel/intel-nvme.c index 7fefdb4c..7009d4f4 100644 --- a/plugins/intel/intel-nvme.c +++ b/plugins/intel/intel-nvme.c @@ -688,8 +688,11 @@ static int get_internal_log(int argc, char **argv, struct command *command, stru }; fd = parse_and_open(argc, argv, desc, command_line_options, &cfg, sizeof(cfg)); - if (fd < 0) + if (fd < 0) { + free(intel); return fd; + } + if (cfg.log > 2 || cfg.core > 4 || cfg.lnum > 255) { free(intel); return EINVAL;