torque/torque-rhbz#758740-r5270-dis-array.patch

28 lines
728 B
Diff
Raw Permalink Normal View History

Index: src/lib/Libifl/tcp_dis.c
===================================================================
--- src/lib/Libifl/tcp_dis.c (revision 5269)
+++ src/lib/Libifl/tcp_dis.c (revision 5270)
@@ -797,12 +797,19 @@
{
struct tcp_chan *tcp;
+ /* On startup tcparray may not yet be initialized. check it */
+ if (tcparray == NULL)
+ return;
+
+ if (fd > tcparraymax)
+ return;
+
tcp = tcparray[fd];
- if(tcp != NULL)
+ if (tcp != NULL)
{
- if(tcp->readbuf.tdis_thebuf != NULL)
+ if (tcp->readbuf.tdis_thebuf != NULL)
free(tcp->readbuf.tdis_thebuf);
- if(tcp->writebuf.tdis_thebuf != NULL)
+ if (tcp->writebuf.tdis_thebuf != NULL)
free(tcp->writebuf.tdis_thebuf);
free(tcp);