File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -759,8 +759,9 @@ class usm_memory : public py::object
759759 {
760760 auto const & api = ::dpctl ::detail ::dpctl_capi ::get ();
761761 DPCTLSyclUSMRef usm_ref = reinterpret_cast < DPCTLSyclUSMRef > (usm_ptr );
762- sycl ::queue * q_ptr = new sycl ::queue (q );
763- DPCTLSyclQueueRef QRef = reinterpret_cast < DPCTLSyclQueueRef > (q_ptr );
762+ auto q_uptr = std ::make_unique < sycl ::queue > (q );
763+ DPCTLSyclQueueRef QRef =
764+ reinterpret_cast < DPCTLSyclQueueRef > (q_uptr .get ());
764765
765766 auto vacuous_destructor = []() {};
766767 py ::object mock_owner = py ::capsule (vacuous_destructor );
@@ -784,7 +785,6 @@ class usm_memory : public py::object
784785 }
785786 if (eptr ) {
786787 Py_DECREF (_memory );
787- delete q_ptr ;
788788 std ::rethrow_exception (eptr );
789789 }
790790 Py_MemoryObject * memobj =
@@ -799,9 +799,9 @@ class usm_memory : public py::object
799799 // std::shared_ptr and the deleter of the shared_ptr<void> is
800800 // supposed to free the USM allocation
801801 m_ptr = _memory ;
802+ q_uptr .release ();
802803 }
803804 else {
804- delete q_ptr ;
805805 Py_DECREF (_memory );
806806
807807 throw std ::runtime_error (
You can’t perform that action at this time.
0 commit comments