Fix memory leak in sweep.c
[pspp] / lib / linreg / sweep.c
index 7d7dfc917fb3d846bdb29d7cc34564a8ea06b1d5..b72d24a7edfebfba71201b28a34d13a374c08804 100644 (file)
@@ -88,7 +88,7 @@ reg_sweep (gsl_matrix * A, int last_col)
            {
              ordered_cols[i] = i;
            }
-         for (i = last_col + 1; i < A->size1 - 1; i++)
+         for (i = last_col + 1; i < A->size1; i++)
            {
              ordered_cols[i - 1] = i;
            }
@@ -169,8 +169,8 @@ reg_sweep (gsl_matrix * A, int last_col)
                  }
            }
          gsl_matrix_free (B);
-         return GSL_SUCCESS;
          free (ordered_cols);
+         return GSL_SUCCESS;
        }
       return GSL_ENOTSQR;
     }