From: Steven G. Johnson Date: Fri, 17 Apr 2015 02:47:43 +0000 (-0400) Subject: fix #26 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=04f8a1e03c91e686a8f10b6e9ee5f0af6aa65aff;p=nlopt.git fix #26 --- diff --git a/api/optimize.c b/api/optimize.c index 2087d8f..0d679dc 100644 --- a/api/optimize.c +++ b/api/optimize.c @@ -248,10 +248,15 @@ static void elimdim_expand(unsigned n, double *v, /* given opt, create a new opt with equal-constraint dimensions eliminated */ static nlopt_opt elimdim_create(nlopt_opt opt) { - nlopt_opt opt0 = nlopt_copy(opt); + nlopt_opt opt0; + nlopt_munge munge_copy_save = opt->munge_on_copy; double *x, *grad = NULL; unsigned i; + opt->munge_on_copy = 0; /* hack: since this is an internal copy, + we can leave it un-munged; see issue #26 */ + opt0 = nlopt_copy(opt); + opt->munge_on_copy = munge_copy_save; if (!opt0) return NULL; x = (double *) malloc(sizeof(double) * opt->n); if (opt->n && !x) { nlopt_destroy(opt0); return NULL; }