Blob Blame History Raw
--- a/src/libmps/monomial/monomial-poly.c	2021-03-25 09:07:05.050947565 -0600
+++ b/src/libmps/monomial/monomial-poly.c	2022-05-24 08:36:56.737564286 -0600
@@ -734,8 +734,18 @@ void mps_monomial_poly_deflate (mps_cont
         }
     }
 
-  /* FIXME: We need to reallocate the correct storage for the 
-   * polynomial. */
-
   poly->degree -= zero_roots;
+
+  /* We remove the storage for the coefficients that have been deflated. */
+  mpc_vclear (p->db.mfpc1 + poly->degree + 1, zero_roots);
+  mpc_vclear (p->db.mfpc2 + poly->degree + 1, zero_roots);
+
+  mpq_vclear (p->initial_mqp_r + poly->degree + 1, zero_roots);
+  mpq_vclear (p->initial_mqp_i + poly->degree + 1, zero_roots);
+
+  mpc_vclear (p->mfppc + poly->degree + 1, zero_roots);
+
+  for (int i = 0; i < zero_roots; i++) {
+    pthread_mutex_destroy (&p->mfpc_mutex[poly->degree + i + 1]);
+  }
 }