Skip to content

Commit

Permalink
in_someip: Clean up memory leak
Browse files Browse the repository at this point in the history
Added code in error legs to free decode buffer.

Signed-off-by: Anthony Payne <[email protected]>
  • Loading branch information
anthonypayne-GM committed Nov 4, 2024
1 parent 0142e58 commit ded0e49
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/in_someip/in_someip_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ in_someip_add_rpc(struct flb_someip *ctx, uint16_t service,
flb_plg_warn(ctx->ins,
"Failed to decode RPC payload. Ignoring RPC.");
flb_free(an_rpc);
flb_sds_destroy(decoded_buffer);
return 0;
}
an_rpc->payload_len = decoded_len;
an_rpc->payload = flb_malloc(decoded_len);
if (an_rpc->payload == NULL) {
flb_errno();
flb_free(an_rpc);
flb_sds_destroy(decoded_buffer);
return -1;
}
memcpy(an_rpc->payload, decoded_buffer, decoded_len);
Expand Down

0 comments on commit ded0e49

Please sign in to comment.