out_forward: add null check for crx->u before deallocation
Without this patch, the following command-line invocation
causes memory corruption.
$ fluent-bit -i dummy -o forward -p Time_as_Integer=invalid
This is because `ctx->u` can be null, depending on when
`cb_forward_init()` aborted the initialization process.
@@ -1188,8 +1188,10 @@ static int cb_forward_exit(void *data, struct flb_config *config)
}
}
else {
+ if (ctx->u) {
flb_upstream_destroy(ctx->u);
}
+ }
flb_free(ctx);
return 0;
