Commit 099e0132 authored by Grant Ramsay's avatar Grant Ramsay Committed by Fabio Baltieri
Browse files

canbus: isotp: Fix context buffer memory leaks

Ensure context buffers are free'd when errors occur

Signed-off-by: default avatarGrant Ramsay <gramsay@enphaseenergy.com>
parent 909f9650
Loading
Loading
Loading
Loading
+2 −0
Changes for subsys/canbus/isotp/isotp.c: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1177,6 +1177,7 @@ static int send(struct isotp_send_ctx *ctx, const struct device *can_dev,
		ret = attach_fc_filter(ctx);
		if (ret) {
			LOG_ERR("Can't attach fc filter: %d", ret);
			free_send_ctx(&ctx);
			return ret;
		}

@@ -1188,6 +1189,7 @@ static int send(struct isotp_send_ctx *ctx, const struct device *can_dev,
		ctx->filter_id = -1;
		ret = send_sf(ctx);
		if (ret) {
			free_send_ctx(&ctx);
			return ret == -EAGAIN ?
			       ISOTP_N_TIMEOUT_A : ISOTP_N_ERROR;
		}