All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Teigland <teigland@sourceware.org>
To: lvm-devel@redhat.com
Subject: master - hints: free hint structs on exit
Date: Wed, 13 May 2020 22:27:24 +0000 (GMT)	[thread overview]
Message-ID: <20200513222724.C1E92385DC14@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5c095400de2f84511726cc8178800d19657b814d
Commit:        5c095400de2f84511726cc8178800d19657b814d
Parent:        2f29765e7fd1135d070310683cf486f07d041c81
Author:        David Teigland <teigland@redhat.com>
AuthorDate:    Wed May 13 17:19:41 2020 -0500
Committer:     David Teigland <teigland@redhat.com>
CommitterDate: Wed May 13 17:20:16 2020 -0500

hints: free hint structs on exit

and free on a couple error paths.
---
 lib/commands/toolcontext.c | 1 +
 lib/label/hints.c          | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 2bd7fabd2..63b6811e5 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -1598,6 +1598,7 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
 	dm_list_init(&cmd->formats);
 	dm_list_init(&cmd->segtypes);
 	dm_list_init(&cmd->tags);
+	dm_list_init(&cmd->hints);
 	dm_list_init(&cmd->config_files);
 	label_init();
 
diff --git a/lib/label/hints.c b/lib/label/hints.c
index 349d5aaef..9546f4880 100644
--- a/lib/label/hints.c
+++ b/lib/label/hints.c
@@ -351,6 +351,7 @@ static void _unlock_hints(struct cmd_context *cmd)
 
 void hints_exit(struct cmd_context *cmd)
 {
+	free_hints(&cmd->hints);
 	if (_hints_fd == -1)
 		return;
 	return _unlock_hints(cmd);
@@ -1321,6 +1322,7 @@ int get_hints(struct cmd_context *cmd, struct dm_list *hints_out, int *newhints,
 	 */
 	if (!_read_hint_file(cmd, &hints_list, &needs_refresh)) {
 		log_debug("get_hints: read fail");
+		free_hints(&hints_list);
 		_unlock_hints(cmd);
 		return 0;
 	}
@@ -1333,6 +1335,7 @@ int get_hints(struct cmd_context *cmd, struct dm_list *hints_out, int *newhints,
 	 */
 	if (needs_refresh) {
 		log_debug("get_hints: needs refresh");
+		free_hints(&hints_list);
 
 		if (!_lock_hints(cmd, LOCK_EX, NONBLOCK))
 			return 0;



                 reply	other threads:[~2020-05-13 22:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200513222724.C1E92385DC14@sourceware.org \
    --to=teigland@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /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.