dccp_recv.c:48:16: warning: Access to field 'btrp' results in a dereference of a null pointer (loaded from variable 'pdd')
btr_pool_free(pdd->btrp);
^~~
In dccp_recv_close(), if pdd is NULL, we avoid closing pdd->fd but
dereference pdd nevertheless one line later. Fix this by returning
early if pdd is NULL.
static void dccp_recv_close(struct receiver_node *rn)
{
-
struct private_dccp_recv_data *pdd = rn->private_data;
- if (pdd && pdd->fd > 0)
+ if (!pdd)
+ return;
+ if (pdd->fd > 0)
close(pdd->fd);
btr_pool_free(pdd->btrp);
- free(rn->private_data);
+ free(pdd);
rn->private_data = NULL;
}