diff --git a/src/util/virtpm.c b/src/util/virtpm.c index b41eb00619..128ca0c579 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); - path = NULL; + *prgs[i].path, prgs[i].parm); if (!*prgs[i].caps) goto cleanup; } - path = NULL; } }