struct commcommon *st=commst;
struct comm_notify_entry *n;
- n=safe_malloc(sizeof(*n),"comm_request_notify");
+ NEW(n);
n->fn=fn;
n->state=nst;
LIST_INSERT_HEAD(&st->notify, n, entry);
if (dict_ilookup_primitive(dict, key)) {
fatal("duplicate key \"%s\" in dictionary",key);
}
- e=safe_malloc(sizeof(*e),"dict_add");
+ NEW(e);
e->next=dict->entries;
e->key=key;
e->val=val;
{
dict_t *d;
- d=safe_malloc(sizeof(*d),"dict_new");
+ NEW(d);
d->parent=parent;
d->search=NULL;
d->entries=NULL;
static struct p_node *node_copy(struct p_node *n)
{
struct p_node *r;
- r=safe_malloc(sizeof(*r),"node_copy");
+ NEW(r);
*r=*n;
return r;
}
{
item_t *i;
- i=safe_malloc(sizeof(*i),"new_item");
+ NEW(i);
i->type=type;
i->loc=loc;
return i;
if (!i) {
/* Did't find it; create a new one */
- i=safe_malloc(sizeof(*i),"intern: alloc list entry");
+ NEW(i);
i->a=safe_strdup(s,"intern: alloc string");
i->next=atoms;
atoms=i;
l=NULL;
r=NULL;
for (i=a; i; i=i->next) {
- b=safe_malloc(sizeof(*b),"list_copy");
+ NEW(b);
if (l) l->next=b; else r=b;
l=b;
b->item=i->item;
{
list_t *l;
- l=safe_malloc(sizeof(*l),"list_append");
+ NEW(l);
l->item=item;
l->next=NULL;
void add_closure(dict_t *dict, cstring_t name, apply_fn apply)
{
closure_t *c;
- c=safe_malloc(sizeof(*c),"add_closure");
+ NEW(c);
c->description=name;
c->type=CL_PURE;
c->apply=apply;
{
struct p_node *r;
- r=safe_malloc(sizeof(*r),"leafnode");
+ NEW(r);
r->type=type;
r->loc.file=config_file;
r->loc.line=config_lineno;
{
struct p_node *rv;
- rv=safe_malloc(sizeof(*rv),"p_node");
+ NEW(rv);
rv->type=type;
rv->loc.file=config_file;
rv->loc.line=config_lineno;
string_t p,g;
item_t *i;
- st=safe_malloc(sizeof(*st),"dh_apply");
+ NEW(st);
st->cl.description="dh";
st->cl.type=CL_DH;
st->cl.apply=NULL;
struct subnet_list *subnet_list_new(void)
{
struct subnet_list *r;
- r=safe_malloc(sizeof(*r),"subnet_list_new:list");
+ NEW(r);
r->entries=0;
r->alloc=DEFAULT_ALLOC;
r->list=safe_malloc_ary(sizeof(*r->list),r->alloc,"subnet_list_new:data");
struct ipset *ipset_new(void)
{
struct ipset *r;
- r=safe_malloc(sizeof(*r),"ipset_new:set");
+ NEW(r);
r->l=0;
r->a=DEFAULT_ALLOC;
r->d=safe_malloc(sizeof(*r->d)*r->a,"ipset_new:data");
if (cl->type!=CL_LOG) {
cfgfatal(item->loc,"init_log","closure is not a logger");
}
- n=safe_malloc(sizeof(*n),"init_log");
+ NEW(n);
n->l=cl->interface;
n->next=l;
l=n;
phase. We should defer writing into the logfile until after we
become a daemon. */
- st=safe_malloc(sizeof(*st),"logfile_apply");
+ NEW(st);
st->cl.description="logfile";
st->cl.type=CL_LOG;
st->cl.apply=NULL;
item_t *item;
string_t facstr;
- st=safe_malloc(sizeof(*st),"syslog_apply");
+ NEW(st);
st->cl.description="syslog";
st->cl.type=CL_LOG;
st->cl.apply=NULL;
{
struct fdlog *st;
- st=safe_malloc(sizeof(*st),"log_from_fd");
+ NEW(st);
st->log=log;
st->fd=fd;
st->prefix=prefix;
{
struct MD5Context *ctx;
- ctx=safe_malloc(sizeof(*ctx),"md5_init");
+ NEW(ctx);
MD5Init(ctx);
return ctx;
uint8_t digest[16];
int i;
- st=safe_malloc(sizeof(*st),"md5_module");
+ NEW(st);
st->cl.description="md5";
st->cl.type=CL_HASH;
st->cl.apply=NULL;
return NULL;
}
- c=safe_malloc(sizeof(*c),"netlink_inst_create");
+ NEW(c);
c->cl.description=name;
c->cl.type=CL_NETLINK;
c->cl.apply=NULL;
item_t *item;
dict_t *dict;
- st=safe_malloc(sizeof(*st),"null_apply");
+ NEW(st);
item=list_elem(args,0);
if (!item || item->type!=t_dict)
struct child *c;
pid_t p;
- c=safe_malloc(sizeof(*c),"makesubproc");
+ NEW(c);
c->desc=desc;
c->cb=cb;
c->cst=cst;
if (rv==i->pid) {
i->finished=True;
- nw=safe_malloc(sizeof(*nw),"sigchld_handler");
+ NEW(nw);
nw->pid=i->pid;
nw->cb=i->cb;
nw->cst=i->cst;
struct signotify *s;
sigset_t old;
- s=safe_malloc(sizeof(*s),"request_signal_notification");
+ NEW(s);
s->signum=signum;
s->notify=notify;
s->cst=cst;
item_t *arg1, *arg2;
string_t filename=NULL;
- st=safe_malloc(sizeof(*st),"random_apply");
+ NEW(st);
st->cl.description="randomsource";
st->cl.type=CL_RANDOMSRC;
item_t *i;
string_t conf;
- st=safe_malloc(sizeof(*st),"adnsresolver_apply");
+ NEW(st);
st->cl.description="adns";
st->cl.type=CL_RESOLVER;
st->cl.apply=NULL;
item_t *i;
string_t e,n;
- st=safe_malloc(sizeof(*st),"rsapub_apply");
+ NEW(st);
st->cl.description="rsapub";
st->cl.type=CL_RSAPUBKEY;
st->cl.apply=NULL;
MP_INT e,d,iqmp,tmp,tmp2,tmp3;
bool_t valid;
- st=safe_malloc(sizeof(*st),"rsapriv_apply");
+ NEW(st);
st->cl.description="rsapriv";
st->cl.type=CL_RSAPRIVKEY;
st->cl.apply=NULL;
{
struct poll_interest *i;
- i=safe_malloc(sizeof(*i),"register_for_poll");
+ NEW(i);
i->before=before;
i->after=after;
i->state=st;
{
SHA1_CTX *ctx;
- ctx=safe_malloc(sizeof(*ctx),"sha1_init");
+ NEW(ctx);
SHA1Init(ctx);
return ctx;
uint8_t digest[20];
int i;
- st=safe_malloc(sizeof(*st),"sha1_module");
+ NEW(st);
st->cl.description="sha1";
st->cl.type=CL_HASH;
st->cl.apply=NULL;
dict_t *dict;
int i;
- st=safe_malloc(sizeof(*st),"site_apply");
+ NEW(st);
st->cl.description="site";
st->cl.type=CL_SITE;
item_t *item;
dict_t *dict;
- st=safe_malloc(sizeof(*st),"userv_apply");
+ NEW(st);
/* First parameter must be a dict */
item=list_elem(args,0);
item_t *item;
dict_t *dict;
- st=safe_malloc(sizeof(*st),"serpent");
+ NEW(st);
st->cl.description="serpent-cbc256";
st->cl.type=CL_TRANSFORM;
st->cl.apply=NULL;
item_t *item;
dict_t *dict;
- st=safe_malloc(sizeof(*st),"eax-serpent");
+ NEW(st);
st->cl.description="eax-serpent";
st->cl.type=CL_TRANSFORM;
st->cl.apply=NULL;
dict_t *dict;
string_t flavour,type;
- st=safe_malloc(sizeof(*st),"tun_apply");
+ NEW(st);
/* First parameter must be a dict */
item=list_elem(args,0);
{
struct phase_hook *h;
- h=safe_malloc(sizeof(*h),"add_hook");
+ NEW(h);
h->fn=fn;
h->state=state;
LIST_INSERT_HEAD(&hooks[phase],h,entry);
bool_t lockdown=False;
uint32_t len=DEFAULT_BUFFER_SIZE;
- st=safe_malloc(sizeof(*st),"buffer_apply");
+ NEW(st);
st->cl.description="buffer";
st->cl.type=CL_BUFFER;
st->cl.apply=NULL;