mirror of
https://github.com/stefanberger/swtpm.git
synced 2026-02-05 05:59:18 +00:00
swtpm_setup: Free string array in case of failure
Free the allocated string array in case of failure. Existing callers auto-free the array already, so there's no memory leak, but it is better to free it in the function where it is allocated. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
49b4b30500
commit
fbbb56b52b
@ -506,6 +506,8 @@ static int swtpm_tpm2_get_all_pcr_banks(struct swtpm *self, gchar ***all_pcr_ban
|
||||
if (ret != 0)
|
||||
return 1;
|
||||
|
||||
*all_pcr_banks = NULL;
|
||||
|
||||
if (tpmresp_len < 17 + sizeof(count))
|
||||
goto err_too_short;
|
||||
memcpy(&count, &tpmresp[17], sizeof(count));
|
||||
@ -541,6 +543,10 @@ static int swtpm_tpm2_get_all_pcr_banks(struct swtpm *self, gchar ***all_pcr_ban
|
||||
|
||||
err_too_short:
|
||||
logerr(self->logfile, "Response from TPM2_GetCapability is too short!\n");
|
||||
|
||||
g_strfreev(*all_pcr_banks);
|
||||
*all_pcr_banks = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user