This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
[Bug]mq_unlink does not correctly free the table entry
- To: <ecos-discuss at sources dot redhat dot com>
- Subject: [ECOS] [Bug]mq_unlink does not correctly free the table entry
- From: "I-Jui Sung" <ijsung at csie dot nctu dot edu dot tw>
- Date: Thu, 25 Oct 2001 04:56:36 +0800
Hi eCos maintainers,
In the compat/posix/current/src/mqueue.cxx, I found a bug that would
cause message queue table entry leaking.
The problem is the do_mq_unlink() function only free the tabent->mq but not
set it to NULL, while the mq_open() will only see entries which have
tabent->mq be NULL as empty slot. Thus a previously unlinked entry will
never be used again.
There's a quick fix: (also attached as mqueue.cxx.patch)
=============================
*** mqueue.cxx.old Thu Oct 25 04:32:40 2001
--- mqueue.cxx Thu Oct 25 04:33:06 2001
***************
*** 142,146 ****
tabent->mq->~Cyg_Mqueue();
free( tabent->mq );
!
CYG_REPORT_RETURN();
}
--- 142,146 ----
tabent->mq->~Cyg_Mqueue();
free( tabent->mq );
! tabent->mq=NULL;
CYG_REPORT_RETURN();
}
mqueue.cxx.patch