Skip to content

Commit

Permalink
canard: ensure all objects are zero init
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge authored and bugobliterator committed Jun 6, 2023
1 parent 12ba1e9 commit 04ac7f5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions canard/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#ifndef CANARD_MALLOC
#include <stdlib.h>
#include <new>
#include <cstring>
#define CANARD_MALLOC malloc
#define CANARD_FREE free
#endif
Expand All @@ -23,6 +24,7 @@ T* allocate(Args...args) {
if (ret == nullptr) {
return nullptr;
}
memset(ret, 0, sizeof(T));
return new(ret) T(args...);
}

Expand Down

0 comments on commit 04ac7f5

Please sign in to comment.