[LLVMbugs] [Bug 21202] New: Memory leak in Support\Windows\RWMutex.inc

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 8 02:21:01 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=21202

            Bug ID: 21202
           Summary: Memory leak in Support\Windows\RWMutex.inc
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: ilias at metaquotes.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In RWMutexImpl constuctor (line 76) 

  if (loadSRW()) {
    data_ = calloc(1, sizeof(SRWLOCK));
    fpInitializeSRWLock(static_cast<PSRWLOCK>(data_));
  } else {
    data_ = calloc(1, sizeof(CRITICAL_SECTION));
    InitializeCriticalSection(static_cast<LPCRITICAL_SECTION>(data_));
  }

memory is allocated in both cases, but in RWMutexImpl destructor (line 86)
memory is freed only in one case

RWMutexImpl::~RWMutexImpl() {
  if (sHasSRW) {
    // Nothing to do in the case of slim reader/writers
  } else {
    DeleteCriticalSection(static_cast<LPCRITICAL_SECTION>(data_));
    free(data_);
  }
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141008/8be3d09d/attachment.html>


More information about the llvm-bugs mailing list