Skip to content

Commit 50de423

Browse files
committed
Avoid memory leak for byte array
Signed-off-by: Arvind Sudarsanam <[email protected]>
1 parent b15e201 commit 50de423

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

llvm/include/llvm/Support/SYCLPropertySetIO.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,13 @@ class SYCLPropertyValue {
6666
return static_cast<Type>(T);
6767
}
6868

69-
~SYCLPropertyValue() {}
70-
69+
~SYCLPropertyValue() {
70+
if (std::holds_alternative<std::byte *>(Val)) {
71+
auto ByteArrayVal = std::get<std::byte *>(Val);
72+
if (ByteArrayVal)
73+
delete[] ByteArrayVal;
74+
}
75+
}
7176
SYCLPropertyValue() = default;
7277

7378
SYCLPropertyValue(Type Ty) {

0 commit comments

Comments
 (0)