summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/ether8003.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@centraldogma>2011-12-12 22:24:25 +0100
committercinap_lenrek <cinap_lenrek@centraldogma>2011-12-12 22:24:25 +0100
commit9679d7525c205de90e9dcadcf6762b04114f8c45 (patch)
tree8681e308104e48eed2753c1b76eba1a8bac57341 /sys/src/9/pc/ether8003.c
parentf32ef135d4bce251f72275d30cfcd86cb188b8c9 (diff)
kernel: fix more malloc bugs
Diffstat (limited to 'sys/src/9/pc/ether8003.c')
-rw-r--r--sys/src/9/pc/ether8003.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/src/9/pc/ether8003.c b/sys/src/9/pc/ether8003.c
index 41244c094..606968f04 100644
--- a/sys/src/9/pc/ether8003.c
+++ b/sys/src/9/pc/ether8003.c
@@ -228,8 +228,13 @@ reset(Ether* ether)
return -1;
}
- ether->ctlr = malloc(sizeof(Dp8390));
- ctlr = ether->ctlr;
+ ctlr = malloc(sizeof(Dp8390));
+ if(ctlr == nil){
+ print("ether8003: can't allocate memory\n");
+ iofree(ether->port);
+ return -1;
+ }
+ ether->ctlr = ctlr;
ctlr->ram = 1;
if((id & 0xFE) == 0x2A)