From 2d39d666abde2d66a55ac4536da3f250d9513f48 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Tue, 15 Nov 2016 21:30:15 +0100 Subject: [PATCH] plugin: Reset context on some error conditions. --- src/core/plugin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/plugin.c b/src/core/plugin.c index e350494..76fc209 100644 --- a/src/core/plugin.c +++ b/src/core/plugin.c @@ -726,6 +726,7 @@ module_load(const char *basedir, const char *name, if ((status = module_init(name, lh, &ctx->info))) { sdb_object_deref(SDB_OBJ(ctx)); + ctx_set(NULL); return status; } @@ -953,13 +954,13 @@ sdb_plugin_load(const char *basedir, const char *name, ctx_t *old_ctx = ctx_set(ctx); status = module_init(ctx->info.plugin_name, ctx->handle, NULL); + ctx_set(old_ctx); if (status) return status; sdb_log(SDB_LOG_INFO, "core: Successfully reloaded plugin " "'%s' (%s)", ctx->info.plugin_name, INFO_GET(&ctx->info, description)); - ctx_set(old_ctx); } ++ctx->use_cnt; return 0; -- 2.30.2