From 964d816726b8c765277b043894d534e9b1e0d60c Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Wed, 11 Jan 2023 23:44:04 +0100 Subject: Check aprintf allocation internally and add astrdup for less OOM_CHECK --- src/ref.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/ref.c') diff --git a/src/ref.c b/src/ref.c index aec1c39..5c98df0 100644 --- a/src/ref.c +++ b/src/ref.c @@ -1,13 +1,15 @@ #include "ref.h" #include "util.h" +#include + struct ref * ref_alloc(void *data) { struct ref *ref; ref = malloc(sizeof(struct ref)); - if (!ref) return NULL; + if (!ref) err(1, "malloc"); ref->link = LINK_EMPTY; ref->data = data; -- cgit v1.2.3-71-gd317