From 91dab140da62ea364af1a82b2b5e67e69205b35f Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 16 Mar 2020 18:44:07 +0100 Subject: [PATCH] mp: Always set mp_context to NULL on errors. In mp_init(), if mp_yyparse() fails, we return early without setting the result pointer to NULL. This does not matter much because both callers of mood.c pass in NULL, but still.. --- mp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mp.c b/mp.c index bade05bc..56c16e31 100644 --- a/mp.c +++ b/mp.c @@ -491,10 +491,10 @@ int mp_init(const char *definition, int nbytes, struct mp_context **result, struct mp_context *ctx; struct yy_buffer_state *buffer_state; + *result = NULL; if (!definition || nbytes == 0) { /* dummy mood */ if (errmsg) *errmsg = NULL; - *result = NULL; return 0; } ctx = para_calloc(sizeof(*ctx)); -- 2.30.2