This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[Bug]mq_unlink does not correctly free the table entry


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]