diff -ur pvfs-1.6.3-pre1/lib/iodcomm.c pvfs-1.6.3-pre1-fixed/lib/iodcomm.c --- pvfs-1.6.3-pre1/lib/iodcomm.c 2004-07-16 11:04:11.000000000 -0500 +++ pvfs-1.6.3-pre1-fixed/lib/iodcomm.c 2004-07-16 11:09:02.000000000 -0500 @@ -312,8 +312,8 @@ errno = ENOMEM; return -1; } + memset(pfds[fd], 0, sizeof(fdesc)); pfds[fd]->fs = FS_RESV; - pfds[fd]->part_p = NULL; pfds[fd]->fd.ref = -1; } return(iodinfo[slot].fd); @@ -337,7 +337,25 @@ ERR1("fd %d was not reserved?!?\n", fd); return(-1); } - free(pfds[fd]); + + /* The following two cases should never happen. Getting here + indicates memory corruption or the fdesc semantics being + broken */ + if (pfds[fd]->part_p != NULL) + { + ERR1("Reserved fd %d had a part_p?!?\n", fd); + free(pfds[fd]->part_p); + pfds[fd]->part_p = NULL; + } + + if (pfds[fd]->fn_p != NULL) + { + ERR1("Reserved fd %d had a fn_p?!?\n", fd); + free(pfds[fd]->fn_p); + pfds[fd]->fn_p = NULL; + } + + free(pfds[fd]); pfds[fd] = NULL; return 0; } @@ -366,6 +384,24 @@ ERR1("fd %d was not reserved?!?\n", fd); continue; } + + /* The following two cases should never happen. Getting here + indicates memory corruption or the fdesc semantics being + broken */ + if (pfds[fd]->part_p != NULL) + { + ERR1("Reserved fd %d had a part_p?!?\n", fd); + free(pfds[fd]->part_p); + pfds[fd]->part_p = NULL; + } + + if (pfds[fd]->fn_p != NULL) + { + ERR1("Reserved fd %d had a fn_p?!?\n", fd); + free(pfds[fd]->fn_p); + pfds[fd]->fn_p = NULL; + } + free(pfds[fd]); pfds[fd] = NULL; iodinfo[i].fd = -1; diff -ur pvfs-1.6.3-pre1/lib/mgrcomm.c pvfs-1.6.3-pre1-fixed/lib/mgrcomm.c --- pvfs-1.6.3-pre1/lib/mgrcomm.c 2004-04-21 15:57:45.000000000 -0500 +++ pvfs-1.6.3-pre1-fixed/lib/mgrcomm.c 2004-07-16 11:13:08.000000000 -0500 @@ -265,8 +265,8 @@ ERR1("fd %d already in use?!?\n", fd); } pfds[fd] = (fdesc_p)malloc(sizeof(fdesc)); + memset(pfds[fd], 0, sizeof(fdesc)); pfds[fd]->fs = FS_RESV; - pfds[fd]->part_p = NULL; pfds[fd]->fd.ref = -1; return(0); } @@ -305,6 +305,24 @@ ERR1("fd %d was not reserved?!?\n", fd); return(-1); } + + /* The following two cases should never happen. Getting here + indicates memory corruption or the fdesc semantics being + broken */ + if (pfds[fd]->part_p != NULL) + { + ERR1("Reserved fd %d had a part_p?!?\n", fd); + free(pfds[fd]->part_p); + pfds[fd]->part_p = NULL; + } + + if (pfds[fd]->fn_p != NULL) + { + ERR1("Reserved fd %d had a fn_p?!?\n", fd); + free(pfds[fd]->fn_p); + pfds[fd]->fn_p = NULL; + } + free(pfds[fd]); pfds[fd] = NULL; return(0);