瀏覽代碼

* ensure that the data of the temp node is freed correctly in case of an error (the error might be non-fatal in case of a generic passing an untyped type to Write/Read)

git-svn-id: trunk@39566 -
svenbarth 7 年之前
父節點
當前提交
3d740f13e4
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      compiler/ninl.pas

+ 9 - 1
compiler/ninl.pas

@@ -1426,7 +1426,15 @@ implementation
 
 
         { if we found an error, simply delete the generated blocknode }
         { if we found an error, simply delete the generated blocknode }
         if found_error then
         if found_error then
-          newblock.free
+          begin
+            { ensure that the tempinfo is freed correctly by destroying a
+              delete node for it
+              Note: this might happen legitimately whe parsing a generic that
+                    passes a undefined type to Write/Read }
+            if assigned(filetemp) then
+              ctempdeletenode.create(filetemp).free;
+            newblock.free
+          end
         else
         else
           begin
           begin
             { deallocate the temp for the file para if we used one }
             { deallocate the temp for the file para if we used one }