From afffaf16a0819e20ce3d0b6de71f3829d8e6219d Mon Sep 17 00:00:00 2001 From: tradke Date: Tue, 8 Jul 2003 10:04:17 +0000 Subject: Fix a memory leak in PrintWarning(). This closes PR CactusUtils/1558. git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/NaNChecker/trunk@45 ff385933-4943-42dc-877b-ffc776028de6 --- src/NaNCheck.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/NaNCheck.c b/src/NaNCheck.c index d7827f0..591bcca 100644 --- a/src/NaNCheck.c +++ b/src/NaNCheck.c @@ -500,7 +500,7 @@ static void PrintWarning (const char *error_type, "%s caught in %svariable '%s'", error_type, complex_part, fullname); } - else + else if (verbose) { /* assume max. 10 characters per index number and 40 characters per coordinate value (including separators) */ @@ -527,24 +527,21 @@ static void PrintWarning (const char *error_type, } } - if (verbose) + if (coords) { - if (coords) - { - CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, - "%s caught in %svariable '%s' at index (%s) with coordinates " - "(%s)", error_type, complex_part, fullname, index_string, - coord_string); - } - else - { - CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, - "%s caught in %svariable '%s' at (%s)", - error_type, complex_part, fullname, index_string); - } - - free (index_string); + CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, + "%s caught in %svariable '%s' at index (%s) with coordinates " + "(%s)", error_type, complex_part, fullname, index_string, + coord_string); + } + else + { + CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, + "%s caught in %svariable '%s' at (%s)", + error_type, complex_part, fullname, index_string); } + + free (index_string); } } -- cgit v1.2.3