aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlurchi <lurchi@strangeplace.net>2018-01-06 18:35:15 +0100
committerlurchi <lurchi@strangeplace.net>2018-01-06 18:35:15 +0100
commit201a67be13ae31b4eb7fb8ad38b349fe287c0baf (patch)
tree37974fbd7ae2cc4ac0f49a02baf0fac364e547e0
parentcc5bb40d158b207c384ae98c868573771735f10a (diff)
downloadgnunet-201a67be13ae31b4eb7fb8ad38b349fe287c0baf.tar.gz
gnunet-201a67be13ae31b4eb7fb8ad38b349fe287c0baf.zip
fix dereferencing uninitialized pointer
-rw-r--r--src/util/scheduler.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index fecbc0de5..2912dd78b 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -756,8 +756,8 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
756 t->fds = fdi; 756 t->fds = fdi;
757 if (1 == read_nh_len) 757 if (1 == read_nh_len)
758 { 758 {
759 GNUNET_assert (NULL != read_nh);
759 fdi->fd = *read_nh; 760 fdi->fd = *read_nh;
760 GNUNET_assert (NULL != fdi->fd);
761 fdi->et = GNUNET_SCHEDULER_ET_IN; 761 fdi->et = GNUNET_SCHEDULER_ET_IN;
762 fdi->sock = GNUNET_NETWORK_get_fd (*read_nh); 762 fdi->sock = GNUNET_NETWORK_get_fd (*read_nh);
763 t->read_fd = fdi->sock; 763 t->read_fd = fdi->sock;
@@ -765,8 +765,8 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
765 } 765 }
766 else if (1 == write_nh_len) 766 else if (1 == write_nh_len)
767 { 767 {
768 GNUNET_assert (NULL != write_nh);
768 fdi->fd = *write_nh; 769 fdi->fd = *write_nh;
769 GNUNET_assert (NULL != fdi->fd);
770 fdi->et = GNUNET_SCHEDULER_ET_OUT; 770 fdi->et = GNUNET_SCHEDULER_ET_OUT;
771 fdi->sock = GNUNET_NETWORK_get_fd (*write_nh); 771 fdi->sock = GNUNET_NETWORK_get_fd (*write_nh);
772 t->read_fd = -1; 772 t->read_fd = -1;
@@ -774,8 +774,8 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
774 } 774 }
775 else if (1 == read_fh_len) 775 else if (1 == read_fh_len)
776 { 776 {
777 GNUNET_assert (NULL != read_fh);
777 fdi->fh = *read_fh; 778 fdi->fh = *read_fh;
778 GNUNET_assert (NULL != fdi->fh);
779 fdi->et = GNUNET_SCHEDULER_ET_IN; 779 fdi->et = GNUNET_SCHEDULER_ET_IN;
780 fdi->sock = (*read_fh)->fd; // FIXME: does not work under WIN32 780 fdi->sock = (*read_fh)->fd; // FIXME: does not work under WIN32
781 t->read_fd = fdi->sock; 781 t->read_fd = fdi->sock;
@@ -783,8 +783,8 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
783 } 783 }
784 else 784 else
785 { 785 {
786 GNUNET_assert (NULL != write_fh);
786 fdi->fh = *write_fh; 787 fdi->fh = *write_fh;
787 GNUNET_assert (NULL != fdi->fh);
788 fdi->et = GNUNET_SCHEDULER_ET_OUT; 788 fdi->et = GNUNET_SCHEDULER_ET_OUT;
789 fdi->sock = (*write_fh)->fd; // FIXME: does not work under WIN32 789 fdi->sock = (*write_fh)->fd; // FIXME: does not work under WIN32
790 t->read_fd = -1; 790 t->read_fd = -1;
@@ -1750,8 +1750,11 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
1750 const struct GNUNET_DISK_FileHandle **write_fhandles; 1750 const struct GNUNET_DISK_FileHandle **write_fhandles;
1751 unsigned int read_nhandles_len, write_nhandles_len, 1751 unsigned int read_nhandles_len, write_nhandles_len,
1752 read_fhandles_len, write_fhandles_len; 1752 read_fhandles_len, write_fhandles_len;
1753 int no_fdsets = (NULL == rs) && (NULL == ws);
1754 int no_socket_descriptors =
1755 ((NULL != rs) && (0 == rs->nsds)) && ((NULL != ws) && (0 == ws->nsds));
1753 1756
1754 if (((NULL == rs) && (NULL == ws)) || ((0 == rs->nsds) && (0 == ws->nsds))) 1757 if (no_fdsets || no_socket_descriptors)
1755 return GNUNET_SCHEDULER_add_delayed_with_priority (delay, 1758 return GNUNET_SCHEDULER_add_delayed_with_priority (delay,
1756 prio, 1759 prio,
1757 task, 1760 task,