Merge pull request #454 from h2o/kazuho/fusion-aligned-free
[fusion][windows] Use `_aligned_free`
diff --git a/lib/fusion.c b/lib/fusion.c
index efd853f..b9f99da 100644
--- a/lib/fusion.c
+++ b/lib/fusion.c
@@ -61,6 +61,9 @@
#ifdef _WINDOWS
#define aligned_alloc(a, s) _aligned_malloc((s), (a))
+#define aligned_free(p) _aligned_free(p)
+#else
+#define aligned_free(p) free(p)
#endif
struct ptls_fusion_aesgcm_context {
@@ -1026,7 +1029,7 @@
return NULL;
memcpy(newp, ctx, old_ctx_size);
ptls_clear_memory(ctx, old_ctx_size);
- free(ctx);
+ aligned_free(ctx);
ctx = newp;
ctx->capacity = capacity;
@@ -1041,7 +1044,7 @@
ptls_clear_memory(ctx, calc_aesgcm_context_size(&ctx->ghash_cnt, ctx->ecb.aesni256));
/* skip ptls_fusion_aesecb_dispose, based on the knowledge that it does not allocate memory elsewhere */
- free(ctx);
+ aligned_free(ctx);
}
static void ctr_dispose(ptls_cipher_context_t *_ctx)