[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/9] pc-bios/s390-ccw/netmain.c: Changed a malloc/free to GLib's
From: |
Mahmoud Mandour |
Subject: |
[PATCH 4/9] pc-bios/s390-ccw/netmain.c: Changed a malloc/free to GLib's variants |
Date: |
Sat, 13 Mar 2021 18:36:48 +0200 |
Changed a call to malloc() and its respective calls free() with
GLib's allocation and deallocation functions.
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
---
pc-bios/s390-ccw/netmain.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c
index 056e93a818..7f78150144 100644
--- a/pc-bios/s390-ccw/netmain.c
+++ b/pc-bios/s390-ccw/netmain.c
@@ -243,7 +243,7 @@ static const char *get_uuid(void)
int i, cc, chk = 0;
static char uuid_str[37];
- mem = malloc(2 * PAGE_SIZE);
+ mem = g_try_malloc(2 * PAGE_SIZE);
if (!mem) {
puts("Out of memory ... can not get UUID.");
return NULL;
@@ -261,7 +261,7 @@ static const char *get_uuid(void)
: "d" (r0), "d" (r1), [addr] "a" (buf)
: "cc", "memory");
if (cc) {
- free(mem);
+ g_free(mem);
return NULL;
}
@@ -269,7 +269,7 @@ static const char *get_uuid(void)
uuid[i] = buf[STSI322_VMDB_UUID_OFFSET + i];
chk |= uuid[i];
}
- free(mem);
+ g_free(mem);
if (!chk) {
return NULL;
}
--
2.25.1
- [PATCH 0/9] Replacing malloc and the like with GLib's variants, Mahmoud Mandour, 2021/03/13
- [PATCH 1/9] bsd-user/elfload.c: Replaced calls to malloc/free with GLib variants, Mahmoud Mandour, 2021/03/13
- [PATCH 2/9] hw/audio/fmopl.c: Fixing some style errors., Mahmoud Mandour, 2021/03/13
- [PATCH 8/9] tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc, Mahmoud Mandour, 2021/03/13
- [PATCH 6/9] util/compatfd.c: Replaced a malloc with GLib's g_try_malloc, Mahmoud Mandour, 2021/03/13
- [PATCH 5/9] target/xtensa: Replaced malloc/free with GLib's variants., Mahmoud Mandour, 2021/03/13
- [PATCH 3/9] hw/audio/fmopl.c: Replaced calls to malloc with GLib's variants, Mahmoud Mandour, 2021/03/13
- [PATCH 7/9] tools/virtiofsd/buffer.c: replaced a calloc call with GLib's g_try_new0, Mahmoud Mandour, 2021/03/13
- [PATCH 4/9] pc-bios/s390-ccw/netmain.c: Changed a malloc/free to GLib's variants,
Mahmoud Mandour <=
- [PATCH 9/9] tools/virtiofsd: Replacing malloc-like calls with GLib's variants, Mahmoud Mandour, 2021/03/13
- Re: [PATCH 0/9] Replacing malloc and the like with GLib's variants, no-reply, 2021/03/13