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
759
759
{
760
760
auto const & api = ::dpctl ::detail ::dpctl_capi ::get ();
761
761
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 ());
764
765
765
766
auto vacuous_destructor = []() {};
766
767
py ::object mock_owner = py ::capsule (vacuous_destructor );
@@ -784,7 +785,6 @@ class usm_memory : public py::object
784
785
}
785
786
if (eptr ) {
786
787
Py_DECREF (_memory );
787
- delete q_ptr ;
788
788
std ::rethrow_exception (eptr );
789
789
}
790
790
Py_MemoryObject * memobj =
@@ -799,9 +799,9 @@ class usm_memory : public py::object
799
799
// std::shared_ptr and the deleter of the shared_ptr<void> is
800
800
// supposed to free the USM allocation
801
801
m_ptr = _memory ;
802
+ q_uptr .release ();
802
803
}
803
804
else {
804
- delete q_ptr ;
805
805
Py_DECREF (_memory );
806
806
807
807
throw std ::runtime_error (
You can’t perform that action at this time.
0 commit comments