Skip to content

Commit e3c09ee

Browse files
authored
Merge pull request #30 from hxef/master
Fix calloc returning junk data
2 parents 94aa533 + ecb4e02 commit e3c09ee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/RE/M/MemoryManager.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ namespace RE
137137

138138
inline void* calloc(std::size_t a_num, std::size_t a_size)
139139
{
140-
return malloc(a_num * a_size);
140+
const auto ret = malloc(a_num * a_size);
141+
if (ret) {
142+
std::memset(ret, 0, a_num * a_size);
143+
}
144+
return ret;
141145
}
142146

143147
template <class T>

0 commit comments

Comments
 (0)