commit e15ee8365a5eb40aaf2448c4f649af30297d6817
parent e29410cee115f099f093605692ec94614fbbe6d9
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 25 Jun 2017 00:42:25 +0200
fix crash if block plugin not found
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/block/block.c b/src/block/block.c
@@ -151,10 +151,9 @@ GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg)
void
GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx)
{
- unsigned int i;
struct Plugin *plugin;
- for (i = 0; i < ctx->num_plugins; i++)
+ for (unsigned int i = 0; i < ctx->num_plugins; i++)
{
plugin = ctx->plugins[i];
GNUNET_break (NULL ==
@@ -301,6 +300,8 @@ GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx,
plugin = find_plugin (ctx,
type);
+ if (NULL == plugin)
+ return NULL;
if (NULL == plugin->create_group)
return NULL;
va_start (ap,