canbus: isotp: Fix context buffer memory leaks
Ensure context buffers are free'd when errors occur Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
This commit is contained in:
parent
0439dfa963
commit
e439b5e56d
1 changed files with 2 additions and 0 deletions
|
@ -1179,6 +1179,7 @@ static int send(struct isotp_send_ctx *ctx, const struct device *can_dev,
|
||||||
ret = attach_fc_filter(ctx);
|
ret = attach_fc_filter(ctx);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOG_ERR("Can't attach fc filter: %d", ret);
|
LOG_ERR("Can't attach fc filter: %d", ret);
|
||||||
|
free_send_ctx(&ctx);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1190,6 +1191,7 @@ static int send(struct isotp_send_ctx *ctx, const struct device *can_dev,
|
||||||
ctx->filter_id = -1;
|
ctx->filter_id = -1;
|
||||||
ret = send_sf(ctx);
|
ret = send_sf(ctx);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
free_send_ctx(&ctx);
|
||||||
return ret == -EAGAIN ?
|
return ret == -EAGAIN ?
|
||||||
ISOTP_N_TIMEOUT_A : ISOTP_N_ERROR;
|
ISOTP_N_TIMEOUT_A : ISOTP_N_ERROR;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue