Cc: Blue Swirl <blauwirbel@xxxxxxxxx> Signed-off-by: Eduardo Habkost <ehabkost@xxxxxxxxxx> --- exec.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/exec.c b/exec.c index c8bfd27..d856325 100644 --- a/exec.c +++ b/exec.c @@ -24,6 +24,9 @@ #include <sys/mman.h> #endif +#include <glib.h> +#include <glib/gprintf.h> + #include "qemu-common.h" #include "cpu.h" #include "tcg.h" @@ -2357,7 +2360,7 @@ static void *file_ram_alloc(RAMBlock *block, ram_addr_t memory, const char *path) { - char *filename; + gchar *filename; void *area; int fd; #ifdef MAP_POPULATE @@ -2379,18 +2382,15 @@ static void *file_ram_alloc(RAMBlock *block, return NULL; } - if (asprintf(&filename, "%s/qemu_back_mem.XXXXXX", path) == -1) { - return NULL; - } - + filename = g_strdup_printf("%s/qemu_back_mem.XXXXXX", path); fd = mkstemp(filename); if (fd < 0) { perror("unable to create backing store for hugepages"); - free(filename); + g_free(filename); return NULL; } unlink(filename); - free(filename); + g_free(filename); memory = (memory + hpagesize - 1) & ~(hpagesize - 1); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html