X-Git-Url: https://git.distorted.org.uk/~mdw/secnet/blobdiff_plain/9c44ef13ed639445ee2e8a4037f7b3c5fcc11aa2..423936d35d7671fd017d2d611d418d1b8eeb6195:/util.c diff --git a/util.c b/util.c index 803098c..d1621fc 100644 --- a/util.c +++ b/util.c @@ -240,7 +240,7 @@ bool_t add_hook(uint32_t phase, hook_fn *fn, void *state) { 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); @@ -398,7 +398,7 @@ static list_t *buffer_apply(closure_t *self, struct cloc loc, dict_t *context, 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; @@ -526,6 +526,7 @@ void string_item_to_iaddr(const item_t *item, uint16_t port, union iaddr *ia, ia->sin.sin_family=AF_INET; ia->sin.sin_addr.s_addr=string_item_to_ipaddr(item,desc); + ia->sin.sin_port=htons(port); #else /* CONFIG_IPV6 => we have adns_text2addr */