We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6842b90 commit 34daed3Copy full SHA for 34daed3
include/clad/Differentiator/Differentiator.h
@@ -355,10 +355,11 @@ T& back(
355
"you pass clad.so to clang.");
356
#endif
357
size_t length = GetLength(code);
358
- char* temp = (char*)malloc(length + 1);
359
- m_Code = temp;
360
- while ((*temp++ = *code++))
361
- ;
+ m_Code = (char*)malloc(length + 1);
+ if (m_Code)
+ memcpy((void*)m_Code, code, length + 1);
+ else
362
+ fprintf(stderr, "Error: Failed to allocate memory for m_Code\n");
363
}
364
365
constexpr CUDA_HOST_DEVICE CladFunction(CladFunctionType f,
0 commit comments