mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
Replace non-portable asprintf by g_strdup_printf
g_strdup_printf already handles OOM errors, so some error handling in QEMU code can be removed. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
0e7a759293
commit
e4ada48242
3 changed files with 9 additions and 17 deletions
8
exec.c
8
exec.c
|
@ -863,18 +863,16 @@ 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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue