From 6c8adc3f30bf0dabdaaa34f2d4d433bb57a0824c Mon Sep 17 00:00:00 2001 From: reuk Date: Fri, 14 Apr 2017 19:47:00 +0100 Subject: [PATCH] Fix memory leak in ansi-c frontend If you swap an irep with an irep that it contains, I think it creates a circular reference which lives until the program quits. --- src/ansi-c/c_typecheck_type.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansi-c/c_typecheck_type.cpp b/src/ansi-c/c_typecheck_type.cpp index d82e81c0038..ac3fe7f2928 100644 --- a/src/ansi-c/c_typecheck_type.cpp +++ b/src/ansi-c/c_typecheck_type.cpp @@ -54,7 +54,7 @@ void c_typecheck_baset::typecheck_type(typet &type) exprt alignment=static_cast(type.find(ID_C_alignment)); irept _typedef=type.find(ID_C_typedef); - type.swap(type.subtype()); + type=type.subtype(); c_qualifiers.write(type); if(packed)