[PATCH] qemu: tpm: Initialize variable with NULL
Marc-André Lureau
marcandre.lureau at redhat.com
Mon Nov 8 14:06:50 UTC 2021
On Mon, Nov 8, 2021 at 5:53 PM Stefan Berger <stefanb at linux.ibm.com> wrote:
>
> Initialize an autofree'd variable with NULL that causes crashes
> if a TPM 1.2 is used and the variable doesn't get a value assigned.
>
> Signed-off-by: Stefan Berger <stefanb at linux.ibm.com>
certainly, I wished there would be a gcc error there..
Reviewed-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
> src/qemu/qemu_tpm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
> index b305313ad2..1992b596cb 100644
> --- a/src/qemu/qemu_tpm.c
> +++ b/src/qemu/qemu_tpm.c
> @@ -610,7 +610,7 @@ qemuTPMEmulatorReconfigure(const char *storagepath,
> {
> g_autoptr(virCommand) cmd = NULL;
> int exitstatus;
> - g_autofree char *activePcrBanksStr;
> + g_autofree char *activePcrBanksStr = NULL;
> g_autofree char *swtpm_setup = virTPMGetSwtpmSetup();
> VIR_AUTOCLOSE pwdfile_fd = -1;
>
> --
> 2.31.1
>
More information about the libvir-list
mailing list