return p-a;
if((n&15) == 0){
na = malloc((n+16)*sizeof(Type*));
+ if(na == nil) {
+ print("%s: out of memory", argv0);
+ errorexit();
+ }
memmove(na, a, n*sizeof(Type*));
free(a);
a = tt->a = na;
if(epc < oldepc) {
Range *n;
n = malloc(sizeof *n);
+ if(n == nil)
+ sysfatal("out of memory");
n->pc = epc;
n->epc = oldepc;
treeput(&breakpoints, n, n);
Range *r;
r = malloc(sizeof *r);
+ if(r == nil)
+ sysfatal("out of memory");
r->pc = pc;
r->epc = epc;
treeput(&breakpoints, r, r);
{
if(p == nil)
p = malloc(sizeof *p);
+ if(p == nil)
+ sysfatal("out of memory");
p->color = color;
p->left = left;
p->key = key;
return 0;
r = malloc(len + 1);
+ if(r == nil) {
+ diag("out of memory");
+ errorexit();
+ }
rb = r;
re = rb + len + 1;
continue;
if (linehist == 0 || linehist->absline != absline) {
Linehist* lh = malloc(sizeof *lh);
+ if(lh == nil) {
+ diag("out of memory");
+ errorexit();
+ }
lh->link = linehist;
lh->absline = absline;
linehist = lh;
}
}
x = malloc(sizeof(PC));
+ if(x == nil)
+ sysfatal("out of memory");
x->pc = pc;
x->callerpc = callerpc;
x->count = 1;
return f;
f = malloc(sizeof *f);
+ if(f == nil)
+ sysfatal("out of memory");
memset(f, 0, sizeof *f);
f->s = s;
f->next = func[h];
// build array
ff = malloc(nfunc*sizeof ff[0]);
+ if(ff == nil)
+ sysfatal("out of memory");
n = 0;
for(h = 0; h < nelem(func); h++)
for(f = func[h]; f != NULL; f = f->next)
return;
// Allocate and link the traces together.
trace = malloc(ntrace * sizeof(Trace));
+ if(trace == nil)
+ sysfatal("out of memory");
tp = trace;
for(p = ppdata; p < e;) {
n = *p++;
}
cmdbuf = malloc(mp->sizeofcmds);
+ if(!cmdbuf) {
+ werrstr("out of memory");
+ return 0;
+ }
seek(fd, hdrsize, 0);
if(read(fd, cmdbuf, mp->sizeofcmds) != mp->sizeofcmds) {
free(cmdbuf);
return 0;
}
cmd = malloc(mp->ncmds * sizeof(MachCmd*));
+ if(!cmd) {
+ free(cmdbuf);
+ werrstr("out of memory");
+ return 0;
+ }
cmdp = cmdbuf;
textva = 0;
textoff = 0;
}
}
sp = malloc(sizeof(Symtab));
+ if(sp == nil)
+ sysfatal("out of memory");
sp->s.name = name;
sp->s.type = type;
sp->s.sig = sig;