From 4e8595efc763bf80e2daac4be108b1ca850891f2 Mon Sep 17 00:00:00 2001 From: stevenj Date: Mon, 12 Jul 2010 18:31:17 -0400 Subject: [PATCH] fix memory leak for error condition darcs-hash:20100712223117-c8de0-1d1a5920fdadab5ae0f7f25154d7b3d823bd6715.gz --- test/testopt.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/testopt.cpp b/test/testopt.cpp index b1fed82..307fddf 100644 --- a/test/testopt.cpp +++ b/test/testopt.cpp @@ -209,6 +209,7 @@ static int test_function(int ifunc) printf("return code %d from nlopt_minimize\n", ret); if (ret < 0 && ret != NLOPT_ROUNDOFF_LIMITED) { fprintf(stderr, "testopt: error in nlopt_minimize\n"); + free(x); return 0; } printf("Found minimum f = %g after %d evaluations.\n", -- 2.30.2