All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - devicesfile: use pool memory
Date: Fri, 23 Apr 2021 21:05:39 +0000 (GMT)	[thread overview]
Message-ID: <20210423210539.0EAF0393BC13@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2b90466f78892c1e578c830a72566662d137dace
Commit:        2b90466f78892c1e578c830a72566662d137dace
Parent:        80ef9138726c85e837dbb5a7572178f8b972e300
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Fri Apr 23 15:03:11 2021 +0200
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Fri Apr 23 22:58:45 2021 +0200

devicesfile: use pool memory

Switch to use command mempool instead of zalloc() as relase
part would be required otherwise.
---
 lib/device/dev-cache.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 05b2b9bff..112296a81 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1710,13 +1710,11 @@ static int _setup_devices_list(struct cmd_context *cmd)
 	 */
 
 	dm_list_iterate_items(strl, &cmd->deviceslist) {
-		if (!(du = zalloc(sizeof(struct dev_use))))
+		if (!(du = dm_pool_zalloc(cmd->mem, sizeof(struct dev_use))))
 			return_0;
 
-		if (!(du->devname = strdup(strl->str))) {
-			free(du);
+		if (!(du->devname = dm_pool_strdup(cmd->mem, strl->str)))
 			return_0;
-		}
 
 		dm_list_add(&cmd->use_devices, &du->list);
 	}



                 reply	other threads:[~2021-04-23 21:05 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=20210423210539.0EAF0393BC13@sourceware.org \
    --to=zkabelac@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.