Obsolete
/
libipc-old
Archived
3
0
Fork 0

Put fd to -1 before freeing memory.

more_to_read
Philippe PITTOLI 2020-01-28 13:42:19 +01:00
parent ac9e329cec
commit 8457cc3690
1 changed files with 1 additions and 0 deletions

View File

@ -563,6 +563,7 @@ struct ipc_error ipc_del_fd (struct ipc_connection_infos *cinfos, int fd)
size_t i; size_t i;
for (i = 0; i < cinfos->size; i++) { for (i = 0; i < cinfos->size; i++) {
if (cinfos->cinfos[i]->fd == fd) { if (cinfos->cinfos[i]->fd == fd) {
cinfos->cinfos[i]->fd = -1;
free (cinfos->cinfos[i]); free (cinfos->cinfos[i]);
cinfos->size--; cinfos->size--;
if (cinfos->size == 0) { if (cinfos->size == 0) {