Skip to content

Commit 6de54e0

Browse files
rettichschnidicarlescufi
authored andcommitted
net: context: Fix memory leak
Allocated, but undersized packets must not just be logged, but also unreferenced before returning an error. Signed-off-by: Reto Schneider <[email protected]>
1 parent 85e7818 commit 6de54e0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

subsys/net/ip/net_context.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,8 @@ static int context_sendto(struct net_context *context,
16691669
if (net_context_get_type(context) == SOCK_DGRAM) {
16701670
NET_ERR("Available payload buffer (%zu) is not enough for requested DGRAM (%zu)",
16711671
tmp_len, len);
1672-
return -ENOMEM;
1672+
ret = -ENOMEM;
1673+
goto fail;
16731674
}
16741675
len = tmp_len;
16751676
}

0 commit comments

Comments
 (0)