Message ID | 20210313163653.37089-5-ma.mandourr@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Replacing malloc and the like with GLib's variants | expand |
On 13.03.21 17:36, Mahmoud Mandour wrote: > 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> Nack. This is BIOS code and it does not have glib. > --- > 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; > } >
> > Nack. > > This is BIOS code and it does not have glib. > Thank you so much for the helping notice. This did not cause build problems nor was mentioned in the bite-sized tasks page as a place to not change. In any case, there are some more problems with this series so I was going to resend it (after amending those problems). Therefore I'm going to exclude this commit. On Sat, Mar 13, 2021 at 8:50 PM Christian Borntraeger < borntraeger@de.ibm.com> wrote: > On 13.03.21 17:36, Mahmoud Mandour wrote: > > 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> > > Nack. > > This is BIOS code and it does not have glib. > > > > --- > > 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; > > } > > >
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; }
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(-)