All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bill O'Donnell <billodo@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: sandeen@sandeen.net
Subject: [PATCH] xfs_spaceman: fix potential memory leak by malloc in scan_ag
Date: Thu, 29 Jun 2017 10:52:56 -0500	[thread overview]
Message-ID: <20170629155256.3607-1-billodo@redhat.com> (raw)

scan_ag mallocs memory that is potentially leaked. Add a free
to alleviate the potential leak.

Fixes CoverityScan CID#1413772 (RESOURCE_LEAK)

Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
 spaceman/freesp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/spaceman/freesp.c b/spaceman/freesp.c
index 22aec821..367c95d1 100644
--- a/spaceman/freesp.c
+++ b/spaceman/freesp.c
@@ -239,7 +239,9 @@ scan_ag(
 			printf(_("%10u %10llu %10llu\n"), agno, freeexts,
 					freeblks);
 	}
+	free(fsmap);
 }
+
 static void
 aglistadd(
 	char		*a)
-- 
2.13.0


             reply	other threads:[~2017-06-29 15:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 15:52 Bill O'Donnell [this message]
2017-06-29 15:59 ` [PATCH] xfs_spaceman: fix potential memory leak by malloc in scan_ag Darrick J. Wong
2017-06-29 16:28   ` Eric Sandeen

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=20170629155256.3607-1-billodo@redhat.com \
    --to=billodo@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.