[PATCH 4/4] virtmp: Fix @path handling in virTPMEmulatorInit()
Ján Tomko
jtomko at redhat.com
Mon Mar 1 17:25:10 UTC 2021
*tpm
On a Monday in 2021, Michal Privoznik wrote:
>This function finds "swtmp", "swtpm_setup" and "swtpm_ioctl"
>binaries in $PATH and stores resolved paths in global variables
>so that they can be obtainer later. Anyway, the resolved path is
>marked as g_autofree and to avoid its freeing later on in the
>function the variable is set to NULL manually. Well, we have
>g_steal_pointer() for thath.
*that
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> src/util/virtpm.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
>diff --git a/src/util/virtpm.c b/src/util/virtpm.c
>index b41eb00619..cd860140d3 100644
>--- a/src/util/virtpm.c
>+++ b/src/util/virtpm.c
>@@ -323,16 +323,14 @@ virTPMEmulatorInit(void)
> _("Could not stat %s"), path);
> goto cleanup;
> }
>- *prgs[i].path = path;
>+ *prgs[i].path = g_steal_pointer(&path);
>
> if (prgs[i].caps) {
> *prgs[i].caps = virTPMGetCaps(prgs[i].typeFromStringFn,
> path, prgs[i].parm);
The path is used here --------------------------^^^^
>- path = NULL;
> if (!*prgs[i].caps)
> goto cleanup;
> }
>- path = NULL;
> }
> }
With that fixed:
Reviewed-by: Ján Tomko <jtomko at redhat.com>
Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210301/d7a0a598/attachment-0001.sig>
More information about the libvir-list
mailing list