Fix double free

master
Alinson S. Xavier 11 years ago
parent 0ea3efa9c5
commit 07c14a33ab

@ -124,7 +124,12 @@ int add_comb_cut(
log_debug("Violation: %.4lf >= %.4lf\n", lhs, rhs);
if (lhs + LP_EPSILON > rhs) goto CLEANUP;
if (lhs + LP_EPSILON > rhs)
{
free(rmatind);
free(rmatval);
goto CLEANUP;
}
cut = (struct Row *) malloc(sizeof(struct Row));
abort_if(!cut, "could not allocate cut");
@ -139,8 +144,6 @@ int add_comb_cut(
abort_if(rval, "LP_add_cut failed");
CLEANUP:
if (rmatind) free(rmatind);
if (rmatval) free(rmatval);
return rval;
}
@ -429,8 +432,8 @@ int find_comb_cuts(struct LP *lp, struct GTSP *data)
if (tooth_count % 2 == 0) continue;
rval = add_comb_cut(lp, data->graph, i, data->node_to_cluster, components,
component_sizes, teeth, tooth_count, x);
rval = add_comb_cut(lp, data->graph, i, data->node_to_cluster,
components, component_sizes, teeth, tooth_count, x);
abort_if(rval, "add_comb_cut failed");
}