Skip to content

Commit

Permalink
in_forward: fix leaks on exception (CID 507786 507954 508064)
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Silva <[email protected]>
  • Loading branch information
edsiper committed Oct 14, 2024
1 parent cad2476 commit c22e7db
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugins/in_forward/fw_prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ static int check_ping(struct flb_input_instance *ins,
if (o.type != MSGPACK_OBJECT_STR) {
flb_plg_error(ins, "Invalid shared_key_salt type message");
flb_free(serverside);
flb_free(hostname);
msgpack_unpacked_destroy(&result);
return -1;
}
Expand All @@ -609,7 +610,9 @@ static int check_ping(struct flb_input_instance *ins,
if (o.type != MSGPACK_OBJECT_STR) {
flb_plg_error(ins, "Invalid shared_key_digest type message");
flb_free(serverside);
flb_free(hostname);
msgpack_unpacked_destroy(&result);

return -1;
}
shared_key_digest = flb_sds_create_len(o.via.str.ptr, o.via.str.size);
Expand All @@ -635,6 +638,7 @@ static int check_ping(struct flb_input_instance *ins,
flb_free(hostname);
flb_free(shared_key_salt);
flb_free(shared_key_digest);
flb_free(username);
msgpack_unpacked_destroy(&result);
return -1;
}
Expand All @@ -649,7 +653,10 @@ static int check_ping(struct flb_input_instance *ins,
flb_free(serverside);
flb_free(username);
flb_free(password_digest);
flb_plg_error(ctx->ins, "failed to hash shard_key");
flb_free(shared_key_salt);
flb_free(shared_key_digest);
flb_free(hostname);
flb_plg_error(ctx->ins, "failed to hash shared_key");
return -1;
}

Expand Down

0 comments on commit c22e7db

Please sign in to comment.