From b2898b5bfcccf14edef025da8e6436a54765948a Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sat, 2 Jan 2021 06:01:41 +0000 Subject: [PATCH] lejp: allow for no cb on unprepared lejp on destroy On an error path, we might not have a valid spa / lejp to destroy. In that case, don't hurl ourselves into calling a function pointer that can be NULL for the destroy cb. --- lib/misc/lejp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/misc/lejp.c b/lib/misc/lejp.c index 49cb44768..707af8827 100644 --- a/lib/misc/lejp.c +++ b/lib/misc/lejp.c @@ -107,7 +107,8 @@ void lejp_destruct(struct lejp_ctx *ctx) { /* no allocations... just let callback know what it happening */ - ctx->pst[0].callback(ctx, LEJPCB_DESTRUCTED); + if (ctx->pst[0].callback) + ctx->pst[0].callback(ctx, LEJPCB_DESTRUCTED); } /**