Skip to content

Commit

Permalink
swtpm: Check gerror before calling g_error_free
Browse files Browse the repository at this point in the history
To avoid glib warning messages check the gerror before calling
g_error_free with it.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
  • Loading branch information
stefanberger committed Sep 24, 2024
1 parent fde7f50 commit 5ece173
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/swtpm/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,8 @@ static int parse_profile_options(const char *options, char **json_profile)
error:
if (profilefd >= 0)
close(profilefd);
g_error_free(gerror);
if (gerror)
g_error_free(gerror);
SWTPM_G_FREE(*json_profile);
option_values_free(ovs);
free(error);
Expand Down

0 comments on commit 5ece173

Please sign in to comment.