Two device pointers pointing out same memory address deallocation problem

Hi, I have such a code having class hiyerarchy. Class A has Class B and Class C pointer. Class B has Class C pointer. Using that scheme , i made device allocation from bottom to top in hierarchy . Assume all data has been prepared in host side. Firstly , what i did is that

A dh_a;  // Class A object which its member will be allocated in device 
A* d_a;  // device pointer for class A 
A  objectA(objectB);  // using constructor i created data in object B 
cudaMalloc(&d_a, sizeof(A));  // I allocated device pointer for Class A.

I allocated dh_a members with transfer_to_device function on device and copied data from objectA to dh_a . Now dh_a object keeps device memory address of object data.
`objectA.transfer_to_device(dh_a); // dh_a will is allocated in device memory and data from object A to dh_a is made in here.
This is the how transfer to device function look like

void ClassA::transfer_to_device(Class A& dh_a)
{
  // since class A has class B and Class C pointers , i made another device to host process for these classes.  
   B  dh_b = objectC->get_grid();  // take host data. 
   cudaMalloc(&dh_a.objectB, sizeof(Class B*));  // objectB  is class A pointer.
   cudaMalloc(&dh_a.objectC, sizeof(Class C));   // objectC  is class C pointer.
   C dh_c;
   C->transfer_to_device(dh_c);  // same logic with this function 
   cudaMemcpy(dh_a.objectB, &dh_b, sizeof(B*), cudaMemcpyHostToDevice);
   cudaMemcpy(dh_a.objectC, &dh_c, sizeof(C), cudaMemcpyHostToDevice); 
  }

I assigned this device memory space to class A device pointer.
cudaMemcpy(d_a, &dh_a, sizeof(A), cudaMemcpyHostToDevice);

Then , for another class , class D , has also class C pointer .
I want to make Class C pointer in Class D point to same memory adress what d_a.objectC points to in device memory.
Then , after allocating this memory address with cudaMalloc (d_d.objectC) , i made pointer assignment inside device kernel. (device side)
d_d.objectC = d_a.objectC
These two pointers points to same memory address without problem.
However , when i deallocate memory for d_a.objectC using following subroutine.
dh_a.free_device_memory()

void Class A::free_device_memory()
{
     C temp;
     cudaMemcpy(&temp, &this->objectC, sizeof (C*), cudaMemcpyDeviceToHost);
     temp.free_device_memory(); // deallocate C members pasting members from device to 
     host
     cudaFree(temp);    
     B* t1;
     cudaMemcpy(&t1, &this->objectB, sizeof (B*), cudaMemcpyDeviceToHost);
     // deallocate C members pasting members from device to  host
     cudaFree(t1);
 }

i deallocated dh_a.objectC memory address with above subroutine from device. So , basically, since dh_d.objectC points to same memory address , this also should be deallocated in device memory. However, when i tried to deallocate dh_d.objectC using cudaFree , I am getting invalid argument , on the other hand, sanitizier shows me memory leaks for that pointer.
What cannot i deallocate dh_d.objectC ? or How i can deallocate ?

Please show a complete minimal example that reproduces your issue.