Skip to contentSkip to conversation

Check return value of qemu_mallocz in qemu_new_timer

PATCH In review vibisreenivasan 2 participants 2 messages Jan 15, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Check return value of qemu_mallocz in qemu_new_timer

Check return value of qemu_mallocz in qemu_new_timer

---

 vl.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
vl.c +0 -0
index e29072b..ffec27f 100644
@@ -1119,6 +1119,8 @@ QEMUTimer *qemu_new_timer(QEMUClock *clock,

QEMUTimerCB *cb, void *opaque)

     QEMUTimer *ts;
 
     ts = qemu_mallocz(sizeof(QEMUTimer));
+    if (!ts)
+        return NULL;
     ts->clock = clock;
     ts->cb = cb;
     ts->opaque = opaque;
#1 lore raw
Quoted 13 lines · vibisreenivasan

Check return value of qemu_mallocz in qemu_new_timer

---

 vl.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
vl.c +0 -0
index e29072b..ffec27f 100644

vl.c QEMUTimer *qemu_new_timer(QEMUClock *clock, · line 1120

Quoted 2 lines
vl.c +0 -0
@@ -1119,6 +1119,8 @@ QEMUTimer *qemu_new_timer(QEMUClock *clock,
 QEMUTimerCB *cb, void *opaque)
 

Your mailer munged this patch.

Regards,

Anthony Liguori

Quoted 9 lines
vl.c +2 -0
     QEMUTimer *ts;
 
     ts = qemu_mallocz(sizeof(QEMUTimer));
+    if (!ts)
+        return NULL;
     ts->clock = clock;
     ts->cb = cb;
     ts->opaque = opaque;