Skip to content

Commit 8dc771c

Browse files
harshaduntwalesys_zuul
authored andcommitted
This is a fix for memleak
Change-Id: I49a939f0d910db36238c8427b7b0bc0472590867
1 parent d8e3194 commit 8dc771c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5117,11 +5117,14 @@ namespace IGC
51175117

51185118
// the kernel has to be padded to have a size aligned on 64 bytes
51195119
size_t padding = iSTD::GetAlignmentOffset(size, 64);//m_program->m_Platform->getKernelPointerAlignSize() );
5120-
void* kernel = IGC::aligned_malloc(size + padding, 16 /* sizeof(DQWORD) */);
5121-
memcpy_s(kernel, size + padding, genxbin, binSize);
5122-
// pad out the rest with 0s
5123-
memset(static_cast<char*>(kernel) + size, 0, padding);
5124-
5120+
void* kernel = nullptr;
5121+
if (size!=0)
5122+
{
5123+
kernel = IGC::aligned_malloc(size + padding, 16 /* sizeof(DQWORD) */);
5124+
memcpy_s(kernel, size + padding, genxbin, binSize);
5125+
// pad out the rest with 0s
5126+
memset(static_cast<char*>(kernel) + size, 0, padding);
5127+
}
51255128
if (binOverride)
51265129
{
51275130
free(genxbin);

0 commit comments

Comments
 (0)