Skip to content

Commit bd7d1bd

Browse files
committed
net: http: Avoid unnecessary net_pkt error print
In some cases the net_pkt can be null when freeing it, this will print error from net_pkt library. Avoid this by checking the value of net_pkt before calling net_pkt_unref(). Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
1 parent c9e6ef5 commit bd7d1bd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

subsys/net/lib/http/http_client.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,9 @@ static void recv_cb(struct net_context *net_ctx, struct net_pkt *pkt,
455455
}
456456

457457
out:
458-
net_pkt_unref(pkt);
458+
if (pkt) {
459+
net_pkt_unref(pkt);
460+
}
459461
}
460462

461463
static int get_local_addr(struct http_client_ctx *ctx)

0 commit comments

Comments
 (0)