From: Chad Brewbaker Date: Wed, 11 Jan 2017 02:51:24 +0000 (-0600) Subject: Quashing memory leak X-Git-Tag: cvc5-1.0.0~5916^2~1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=35a38fb42559cde5044d4665522be80433509edc;p=cvc5.git Quashing memory leak --- 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]; } }