From: stevenj Date: Mon, 12 Jul 2010 22:31:17 +0000 (-0400) Subject: fix memory leak for error condition X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=4e8595efc763bf80e2daac4be108b1ca850891f2;p=nlopt.git fix memory leak for error condition darcs-hash:20100712223117-c8de0-1d1a5920fdadab5ae0f7f25154d7b3d823bd6715.gz --- 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",