summaryrefslogtreecommitdiffstats
path: root/src/ref.c
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-01-11 23:44:04 +0100
committerLouis Burda <quent.burda@gmail.com>2023-01-11 23:44:04 +0100
commit964d816726b8c765277b043894d534e9b1e0d60c (patch)
tree0a7769532ebd41007a914889a0e96d171ad1ca55 /src/ref.c
parenta9d37006eae7227d498c7c658360ee1e43b3e054 (diff)
downloadtmus-964d816726b8c765277b043894d534e9b1e0d60c.tar.gz
tmus-964d816726b8c765277b043894d534e9b1e0d60c.zip
Check aprintf allocation internally and add astrdup for less OOM_CHECK
Diffstat (limited to 'src/ref.c')
-rw-r--r--src/ref.c4
1 files changed, 3 insertions, 1 deletions
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 <err.h>
+
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;