linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: linux-xfs <linux-xfs@vger.kernel.org>
Cc: Eric Biggers <ebiggers@google.com>
Subject: [PATCH] xfs_io: fix memory leak in add_enckey
Date: Thu, 7 Nov 2019 10:50:59 -0600	[thread overview]
Message-ID: <4eb1073f-91fb-a4bc-aae8-d54dc5a6b8aa@redhat.com> (raw)

Invalid arguments to add_enckey will leak the "arg" allocation,
so fix that.

Fixes: ba71de04 ("xfs_io/encrypt: add 'add_enckey' command")
Fixes-coverity-id: 1454644
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/io/encrypt.c b/io/encrypt.c
index 17d61cfb..c6a4e190 100644
--- a/io/encrypt.c
+++ b/io/encrypt.c
@@ -696,6 +696,7 @@ add_enckey_f(int argc, char **argv)
 				goto out;
 			break;
 		default:
+			free(arg);
 			return command_usage(&add_enckey_cmd);
 		}
 	}


             reply	other threads:[~2019-11-07 16:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 16:50 Eric Sandeen [this message]
2019-11-07 20:29 ` [PATCH] xfs_io: fix memory leak in add_enckey Bill O'Donnell
2019-11-07 21:46 ` Eric Biggers
2019-11-07 21:58   ` Eric Sandeen
2019-11-11 15:13     ` Eric Sandeen
2019-11-11 17:27       ` Eric Biggers
2019-11-11 18:07         ` Eric Sandeen
2019-11-14 21:09           ` Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4eb1073f-91fb-a4bc-aae8-d54dc5a6b8aa@redhat.com \
    --to=sandeen@redhat.com \
    --cc=ebiggers@google.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).