diff --git a/lib/pari.c b/lib/pari.c
index e7f7e6fe4bd12322246999f4d2b5820a6b456e35..ec267728f3c06fa0027b5ea3698f0af89920b941 100644
--- a/lib/pari.c
+++ b/lib/pari.c
@@ -524,7 +524,7 @@ void mpzx_oneroot_split_mod (mpz_ptr root, mpzx_srcptr f, mpz_srcptr p,
    /* Compute in root a root of the polynomial f over the prime field
       of characteristic p, assuming that f splits completely. */
 {
-   mpzx_t F, factor, factorloc;
+   mpzx_t F, factor;
    mpz_t inv;
    int i;
    cm_timer_t clock;
@@ -548,22 +548,18 @@ void mpzx_oneroot_split_mod (mpz_ptr root, mpzx_srcptr f, mpz_srcptr p,
 
    while (F->deg != 1) {
       /* Try to read a factor of F from a checkpointing file. */
-      if (tmpdir != NULL) {
-         mpzx_init (factorloc, -1);
-         if (cm_file_read_factor (tmpdir, factorloc, F, p)) {
-            mpzx_set (F, factorloc);
-            if (debug)
-               cm_file_printf ("    Read factor of degree %i\n", F->deg);
-         }
-         mpzx_clear (factorloc);
+      if (tmpdir != NULL && cm_file_read_factor (tmpdir, factor, F, p)) {
+         if (debug)
+            cm_file_printf ("    Read factor of degree %i\n", factor->deg);
       }
+      else {
+         /* Find a factor. */
+         mpzx_onefactor_split_mod (factor, F, p, debug);
 
-      /* Find a smaller factor. */
-      mpzx_onefactor_split_mod (factor, F, p, debug);
-
-      /* Write the factor to a checkpointing file. */
-      if (tmpdir != NULL)
-         cm_file_write_factor (tmpdir, factor, F, p);
+         /* Write the factor to a checkpointing file. */
+         if (tmpdir != NULL)
+            cm_file_write_factor (tmpdir, factor, F, p);
+      }
 
       /* Replace F by the factor. */
       mpzx_set (F, factor);