diff options
-rw-r--r-- | mg2d.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -481,6 +481,9 @@ MG2DContext *mg2d_solver_alloc(size_t domain_size) MG2DInternal *priv; int ret; + if (SIZE_MAX / domain_size < domain_size) + return NULL; + ctx = calloc(1, sizeof(*ctx)); if (!ctx) return NULL; @@ -490,9 +493,6 @@ MG2DContext *mg2d_solver_alloc(size_t domain_size) goto fail; priv = ctx->priv; - if (SIZE_MAX / domain_size < domain_size) - goto fail; - priv->logger.log = log_callback; priv->logger.opaque = ctx; |