ref: 3cccb8fb124b3dffd9124551d74c13b4531dc3f2
parent: 8020743579ed7398bf0c61e5723d827d41d70475
author: cinap_lenrek <[email protected]>
date: Sun May 12 15:04:07 EDT 2013
devaoe: avoid panic on malloc() error by using smalloc() instead.
--- a/sys/src/9/port/devaoe.c
+++ b/sys/src/9/port/devaoe.c
@@ -1362,7 +1362,7 @@
return 0;
l = d->dl + i;
- s = p = malloc(READSTR);
+ s = p = smalloc(READSTR);
e = s + READSTR;
p = seprint(p, e, "addr: ");
@@ -1398,7 +1398,7 @@
char *s, *p, *e;
Netlink *n;
- s = p = malloc(READSTR);
+ s = p = smalloc(READSTR);
e = s + READSTR;
p = seprint(p, e, "debug: %d\n", debug);
@@ -1463,7 +1463,7 @@
if(len > sizeof d->config)
error(Etoobig);
srb = srballoc(len);
- s = malloc(len);
+ s = smalloc(len);
memmove(s, db, len);
if(waserror()){
srbfree(srb);
@@ -1679,7 +1679,7 @@
case Qconfig:
if(off + n > sizeof d->config)
error(Etoobig);
- buf = malloc(sizeof d->config);
+ buf = smalloc(sizeof d->config);
if(waserror()){
free(buf);
nexterror();