Skip to content

Commit

Permalink
Merge pull request IntelPython#1550 from IntelPython/address-coverity…
Browse files Browse the repository at this point in the history
…-issue-possible-resource-leak

Rewrite some properties to delete arrays before dealing w/ objects
  • Loading branch information
oleksandr-pavlyk authored Feb 15, 2024
2 parents f528c73 + 8bcf121 commit fdf326b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dpctl/_sycl_device.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -760,12 +760,13 @@ cdef class SyclDevice(_SyclDevice):
used to enqueue a kernel on the device.
"""
cdef size_t *max_work_item_sizes1d = NULL
cdef size_t s0
max_work_item_sizes1d = DPCTLDevice_GetMaxWorkItemSizes1d(
self._device_ref
)
res = (max_work_item_sizes1d[0], )
s0 = max_work_item_sizes1d[0]
DPCTLSize_t_Array_Delete(max_work_item_sizes1d)
return res
return (s0, )

@property
def max_work_item_sizes2d(self):
Expand All @@ -779,12 +780,15 @@ cdef class SyclDevice(_SyclDevice):
dimension of a 2D range used to enqueue a kernel on the device.
"""
cdef size_t *max_work_item_sizes2d = NULL
cdef size_t s0
cdef size_t s1
max_work_item_sizes2d = DPCTLDevice_GetMaxWorkItemSizes2d(
self._device_ref
)
res = (max_work_item_sizes2d[0], max_work_item_sizes2d[1],)
s0 = max_work_item_sizes2d[0]
s1 = max_work_item_sizes2d[1]
DPCTLSize_t_Array_Delete(max_work_item_sizes2d)
return res
return (s0, s1,)

@property
def max_work_item_sizes3d(self):
Expand Down

0 comments on commit fdf326b

Please sign in to comment.