Skip to content

Commit bf8d391

Browse files
jukkargalak
authored andcommitted
net: context: Check if we run out of mem
The context_alloc_pkt() might run out of memory, and if that happens we must not try to set the context pointer in it. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 69afd80 commit bf8d391

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

subsys/net/ip/net_context.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,8 +1255,9 @@ static struct net_pkt *context_alloc_pkt(struct net_context *context,
12551255
net_context_get_family(context),
12561256
net_context_get_ip_proto(context),
12571257
timeout);
1258-
1259-
net_pkt_set_context(pkt, context);
1258+
if (pkt) {
1259+
net_pkt_set_context(pkt, context);
1260+
}
12601261

12611262
return pkt;
12621263
}

0 commit comments

Comments
 (0)