From 35a38fb42559cde5044d4665522be80433509edc Mon Sep 17 00:00:00 2001 From: Chad Brewbaker Date: Tue, 10 Jan 2017 20:51:24 -0600 Subject: [PATCH] Quashing memory leak --- src/base/cvc4_assert.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/base/cvc4_assert.cpp b/src/base/cvc4_assert.cpp index 8d5b9e508..9d578dc07 100644 --- a/src/base/cvc4_assert.cpp +++ b/src/base/cvc4_assert.cpp @@ -38,10 +38,10 @@ void AssertionException::construct(const char* header, const char* extra, // then with a larger one if sprintf tells us to. int n = 512; char* buf; + buf = new char[n]; for(;;) { - buf = new char[n]; - + int size; if(extra == NULL) { size = snprintf(buf, n, "%s\n%s\n%s:%d\n", @@ -66,6 +66,7 @@ void AssertionException::construct(const char* header, const char* extra, // try again with a buffer that's large enough n = size + 1; delete [] buf; + buf = new char[n]; } } -- 2.30.2