From 9b45ba82fd38d30d9f6bbe3f659e33a32b3b5ace Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 4 Sep 2020 12:24:25 +0000 Subject: [PATCH] calloc cb data so the client is NULL. --- cmd-load-buffer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c index f5a080be..bca9a860 100644 --- a/cmd-load-buffer.c +++ b/cmd-load-buffer.c @@ -96,12 +96,10 @@ cmd_load_buffer_exec(struct cmd *self, struct cmdq_item *item) const char *bufname = args_get(args, 'b'); char *path; - cdata = xmalloc(sizeof *cdata); + cdata = xcalloc(1, sizeof *cdata); cdata->item = item; if (bufname != NULL) cdata->name = xstrdup(bufname); - else - cdata->name = NULL; if (args_has(args, 'w') && tc != NULL) { cdata->client = tc; cdata->client->references++;