From: Andre Noll Date: Mon, 16 Mar 2020 17:44:07 +0000 (+0100) Subject: mp: Always set mp_context to NULL on errors. X-Git-Tag: v0.6.3~8 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=91dab140da62ea364af1a82b2b5e67e69205b35f;ds=sidebyside 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.. --- 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));