1. petsc
  2. PETSc
  3. petsc

Commits

Jed Brown  committed 8c6db3d

Mat: close memory leaks in MatGetOrdering_Spectral

  • Participants
  • Parent commits bbbf719
  • Branches master

Comments (0)

Files changed (1)

File src/mat/order/spectral.c

View file
 #endif
     if (lierr) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_LIB, "Error in LAPACK routine %d", (int) lierr);
     ierr = PetscFPTrapPop();CHKERRQ(ierr);
+    ierr = MatDenseRestoreArray(LD,&a);CHKERRQ(ierr);
+    ierr = MatDestroy(&LD);CHKERRQ(ierr);
     /* Check lowest eigenvalue and eigenvector */
     ierr = PetscMalloc1(n, &perm);CHKERRQ(ierr);
     for (i = 0; i < n; ++i) perm[i] = i;
     ierr = ISCreateGeneral(PETSC_COMM_SELF, n, perm, PETSC_OWN_POINTER, row);CHKERRQ(ierr);
     ierr = PetscObjectReference((PetscObject) *row);CHKERRQ(ierr);
     *col = *row;
+
+    ierr = PetscFree4(realpart,imagpart,eigvec,work);CHKERRQ(ierr);
+    ierr = MatDestroy(&L);CHKERRQ(ierr);
   }
   PetscFunctionReturn(0);
 }