+/*
+ * Free a FactorsCHull
+ *
+ * Args:
+ * factorsCHull: container of Factors
+ */
+void destroyFactorsCHull(FactorsCHull* factorsCHull)
+{
+ if (factorsCHull->type == MIDDLE || factorsCHull->type ==
+ INCOMPLETE || factorsCHull->type == ABSENT)
+ {
+ free(factorsCHull->min);
+ free(factorsCHull->max);
+ }
+ else if (factorsCHull->type == SCREWED)
+ {
+ if (factorsCHull->min != NULL)
+ {
+ free(factorsCHull->min);
+ }
+ if (factorsCHull->max != NULL)
+ {
+ free(factorsCHull->max);
+ }
+ }
+
+ if (factorsCHull->type == EXACT || factorsCHull->type == MIDDLE ||
+ factorsCHull->type == FALLBACK)
+ {
+ free(factorsCHull->approx);
+ }
+}
+
+