Commits

Satish Balay committed 4a73821

cusp: fix VecGetArray() as its switching codepath to cusp [when it shouldn't]
This fixes memory leak in src/ksp/ksp/examples/tutorials, runex43_3 etc.
[with cusp/txpetscgpu enabled]

Comments (0)

Files changed (1)

src/vec/vec/interface/rvector.c

   PetscValidHeaderSpecific(x,VEC_CLASSID,1);
   if (x->petscnative) {
 #if defined(PETSC_HAVE_CUSP)
-    if (x->valid_GPU_array == PETSC_CUSP_GPU || !*((PetscScalar**)x->data)) {
+    if (x->valid_GPU_array == PETSC_CUSP_GPU) {
       ierr = VecCUSPCopyFromGPU(x);CHKERRQ(ierr);
     }
 #endif
   PetscValidHeaderSpecific(x,VEC_CLASSID,1);
   if (x->petscnative) {
 #if defined(PETSC_HAVE_CUSP)
-    if (x->valid_GPU_array == PETSC_CUSP_GPU || !*((PetscScalar**)x->data)) {
+    if (x->valid_GPU_array == PETSC_CUSP_GPU) {
       ierr = VecCUSPCopyFromGPU(x);CHKERRQ(ierr);
     }
 #endif