summaryrefslogtreecommitdiffstats
path: root/mdoc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mdoc.c b/mdoc.c
index e51f7771..783ea1a2 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -241,7 +241,8 @@ mdoc_alloc(void *data, const struct mdoc_cb *cb)
p = xcalloc(1, sizeof(struct mdoc));
p->data = data;
- (void)memcpy(&p->cb, cb, sizeof(struct mdoc_cb));
+ if (cb)
+ (void)memcpy(&p->cb, cb, sizeof(struct mdoc_cb));
p->last = xcalloc(1, sizeof(struct mdoc_node));
p->last->type = MDOC_ROOT;