dccp_recv: Avoid NULL pointer dereference.
[paraslash.git] / dccp_recv.c
index af8e6b1..a9eab00 100644 (file)
@@ -40,13 +40,14 @@ struct private_dccp_recv_data {
 
 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;
 }