Skip to content

Commit a8d39bb

Browse files
cosmo0920edsiper
authored andcommitted
out_http: Plug a NULL dereference
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent e971292 commit a8d39bb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

plugins/out_http/http.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,18 @@ static int http_post(struct flb_out_http *ctx,
178178
ctx->host, ctx->port,
179179
ctx->proxy, 0);
180180

181+
if (c == NULL) {
182+
flb_plg_error(ctx->ins, "[http_client] failed to create HTTP client");
183+
if (payload_buf != body) {
184+
flb_free(payload_buf);
185+
}
186+
187+
if (u_conn) {
188+
flb_upstream_conn_release(u_conn);
189+
}
190+
191+
return FLB_RETRY;
192+
}
181193

182194
if (c->proxy.host) {
183195
flb_plg_debug(ctx->ins, "[http_client] proxy host: %s port: %i",

0 commit comments

Comments
 (0)