ceesectionstring: Fix a potential memory leak
authorLioncash <mathew1800@gmail.com>
Thu, 12 Feb 2015 13:13:54 +0000 (08:13 -0500)
committerLioncash <mathew1800@gmail.com>
Thu, 12 Feb 2015 13:13:57 +0000 (08:13 -0500)
src/md/ceefilegen/ceesectionstring.cpp

index 7a43dd3..314b3a6 100644 (file)
@@ -74,8 +74,10 @@ StringTableEntry* CeeSectionString::createEntry(__in_z LPWSTR target, ULONG hash
     entry->m_hashId = hashId;
     entry->m_offset = dataLen();
     size_t len = (wcslen(target)+1) * sizeof(wchar_t);
-    if (len > ULONG_MAX)
+    if (len > ULONG_MAX) {
+        delete entry;
         return NULL;
+    }
     void *buf = getBlock((ULONG)len);
     if (!buf) {
         delete entry;