Message ID | 20210512173701.4bd04817@ivy-bridge (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix various memory leaks | expand |
diff --git a/plugins/hostname.c b/plugins/hostname.c index f7ab9e8bc..1a9513adb 100644 --- a/plugins/hostname.c +++ b/plugins/hostname.c @@ -213,11 +213,10 @@ static void read_dmi_fallback(void) return; type = atoi(contents); + g_free(contents); if (type < 0 || type > 0x1D) return; - g_free(contents); - /* from systemd hostname chassis list */ switch (type) { case 0x3:
g_file_get_contents allocates memory. It needs to be freed on any function exit. Signed-off-by: Steve Grubb <sgrubb@redhat.com> --- plugins/hostname.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)