Skip to content

Commit

Permalink
Zero memory allocated by wasm_memory_storage
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonpayton committed Apr 11, 2024
1 parent 566cac0 commit c304fec
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "php.h"
#include "ext/standard/info.h"
#include "Zend/zend_alloc.h"
Expand All @@ -42,6 +43,7 @@ void* wasm_memory_storage_chunk_alloc(zend_mm_storage* storage, size_t size, siz
if (posix_memalign(&ptr, alignment, size) == 0)
{
fprintf(stderr, "wasm_memory_storage_chunk_alloc: allocated: %p, size=%zu, alignment=%zu\n", ptr, size, alignment);
memset(ptr, 0, size);
return ptr;
} else {
fprintf(stderr, "wasm_memory_storage_chunk_alloc: failed\n");
Expand Down

0 comments on commit c304fec

Please sign in to comment.