summaryrefslogtreecommitdiff
path: root/sys/src/9/port/portclock.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@centraldogma>2011-12-12 16:55:26 +0100
committercinap_lenrek <cinap_lenrek@centraldogma>2011-12-12 16:55:26 +0100
commitbf3476d661e05208b78f70cdaa5656ff77264d23 (patch)
treef5c52910b93aa74586740a54f6b2911e95ae96cc /sys/src/9/port/portclock.c
parent589f99915eb95d9207c08259c8880675a0a502cf (diff)
kernel: fix inproper use of malloc/smalloc
Diffstat (limited to 'sys/src/9/port/portclock.c')
-rw-r--r--sys/src/9/port/portclock.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/src/9/port/portclock.c b/sys/src/9/port/portclock.c
index 624283d3c..3f7d4be7c 100644
--- a/sys/src/9/port/portclock.c
+++ b/sys/src/9/port/portclock.c
@@ -214,6 +214,8 @@ timersinit(void)
*/
todinit();
t = malloc(sizeof(*t));
+ if(t == nil)
+ panic("timersinit: no memory for Timer");
t->tmode = Tperiodic;
t->tt = nil;
t->tns = 1000000000/HZ;
@@ -229,6 +231,8 @@ addclock0link(void (*f)(void), int ms)
/* Synchronize to hztimer if ms is 0 */
nt = malloc(sizeof(Timer));
+ if(nt == nil)
+ panic("addclock0link: no memory for Timer");
if(ms == 0)
ms = 1000/HZ;
nt->tns = (vlong)ms*1000000LL;