From: Md Haris Iqbal <haris.phnx@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Md Haris Iqbal <haris.phnx@gmail.com>
Subject: [Qemu-devel] [PATCH] Changed malloc() to g_malloc() at places where return value was not being checked
Date: Tue, 22 Mar 2016 20:03:39 +0530 [thread overview]
Message-ID: <1458657219-12156-1-git-send-email-haris.phnx@gmail.com> (raw)
Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com>
---
bsd-user/elfload.c | 2 +-
bsd-user/qemu.h | 2 +-
linux-user/qemu.h | 2 +-
thunk.c | 2 +-
ui/shader.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
index 0a6092b..40bd1f2 100644
--- a/bsd-user/elfload.c
+++ b/bsd-user/elfload.c
@@ -1064,7 +1064,7 @@ static void load_symbols(struct elfhdr *hdr, int fd)
found:
/* Now know where the strtab and symtab are. Snarf them. */
- s = malloc(sizeof(*s));
+ s = g_malloc(sizeof(*s));
syms = malloc(symtab.sh_size);
if (!syms) {
free(s);
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 03b502a..ada4360 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -357,7 +357,7 @@ static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy
#ifdef DEBUG_REMAP
{
void *addr;
- addr = malloc(len);
+ addr = g_malloc(len);
if (copy)
memcpy(addr, g2h(guest_addr), len);
else
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 26b0ba2..615b9b9 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -381,7 +381,7 @@ static inline void *lock_user(int type, abi_ulong guest_addr, long len, int copy
#ifdef DEBUG_REMAP
{
void *addr;
- addr = malloc(len);
+ addr = g_malloc(len);
if (copy)
memcpy(addr, g2h(guest_addr), len);
else
diff --git a/thunk.c b/thunk.c
index f057d86..bddabae 100644
--- a/thunk.c
+++ b/thunk.c
@@ -88,7 +88,7 @@ void thunk_register_struct(int id, const char *name, const argtype *types)
for(i = 0;i < 2; i++) {
offset = 0;
max_align = 1;
- se->field_offsets[i] = malloc(nb_fields * sizeof(int));
+ se->field_offsets[i] = g_malloc(nb_fields * sizeof(int));
type_ptr = se->field_types;
for(j = 0;j < nb_fields; j++) {
size = thunk_type_size(type_ptr, i);
diff --git a/ui/shader.c b/ui/shader.c
index 9264009..43c6f64 100644
--- a/ui/shader.c
+++ b/ui/shader.c
@@ -83,7 +83,7 @@ GLuint qemu_gl_create_compile_shader(GLenum type, const GLchar *src)
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
if (!status) {
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);
- errmsg = malloc(length);
+ errmsg = g_malloc(length);
glGetShaderInfoLog(shader, length, &length, errmsg);
fprintf(stderr, "%s: compile %s error\n%s\n", __func__,
(type == GL_VERTEX_SHADER) ? "vertex" : "fragment",
--
1.9.1
next reply other threads:[~2016-03-22 14:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 14:33 Md Haris Iqbal [this message]
2016-03-22 14:57 ` [Qemu-devel] [PATCH] Changed malloc() to g_malloc() at places where return value was not being checked Peter Maydell
2016-03-22 15:52 ` haris iqbal
2016-03-22 16:05 ` Paolo Bonzini
2016-03-22 16:15 ` haris iqbal
2016-03-22 16:46 ` Peter Maydell
2016-03-22 16:50 ` haris iqbal
2016-03-22 15:15 ` Markus Armbruster
2016-03-22 15:52 ` haris iqbal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1458657219-12156-1-git-send-email-haris.phnx@gmail.com \
--to=haris.phnx@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).