Free the old uuid before overwriting it with an error message. Also strdup() the error message since the error object gets freed just after this code.
Signed-off-by: Russell Bryant rbryant@redhat.com --- src/lib/host_linux.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/lib/host_linux.c b/src/lib/host_linux.c index fd748c1..fa4d41c 100644 --- a/src/lib/host_linux.c +++ b/src/lib/host_linux.c @@ -274,7 +274,8 @@ char *host_os_reboot_uuid(void)
if(g_file_set_contents(file, uuid, strlen(uuid), &error) == FALSE) { mh_info("%s", error->message); - uuid = error->message; + free(uuid); + uuid = strdup(error->message); }
if(error) {